*** pine/ttyout.c.REAL	Thu Dec 21 02:08:20 1995
--- pine/ttyout.c	Sat Feb 10 15:47:12 1996
***************
*** 131,137 ****
              *_startinsert, *_endinsert, *_insertchar, *_deletechar,
              *_deleteline, *_insertline,
              *_scrollregion, *_scrollup, *_scrolldown,
!             *_termcap_init, *_termcap_end;
  char  term_name[40];
  #ifndef USE_TERMINFO
  static char  _terminal[1024];         /* Storage for terminal entry */
--- 131,138 ----
              *_startinsert, *_endinsert, *_insertchar, *_deletechar,
              *_deleteline, *_insertline,
              *_scrollregion, *_scrollup, *_scrolldown,
!             *_termcap_init, *_termcap_end,
! 	    *_keypad_init, *_keypad_end;
  char  term_name[40];
  #ifndef USE_TERMINFO
  static char  _terminal[1024];         /* Storage for terminal entry */
***************
*** 228,233 ****
--- 229,236 ----
      _termcap_end       = tigetstr("rmcup");
      _lines	       = tigetnum("lines");
      _columns	       = tigetnum("cols");
+     _keypad_init       = tigetnum("smkx");
+     _keypad_end	       = tigetnum("rmkx");
      _ku                = tigetstr("kcuu1");
      _kd                = tigetstr("kcud1");
      _kl                = tigetstr("kcub1");
***************
*** 295,300 ****
--- 298,305 ----
      _termcap_end       = tgetstr("te", &ptr);
      _lines	       = tgetnum("li");
      _columns	       = tgetnum("co");
+     _keypad_init       = tgetstr("ks", &ptr);
+     _keypad_end	       = tgetstr("ke", &ptr);
      _ku                = tgetstr("ku", &ptr);
      _kd                = tgetstr("kd", &ptr);
      _kl                = tgetstr("kl", &ptr);
***************
*** 435,440 ****
--- 440,448 ----
  	BeginScroll(0, ps_global->ttyo->screen_rows);
  	fflush(stdout);
      }
+ 
+     if(_keypad_init)
+       tputs(_keypad_init, 1, outchar);
  }
          
  
***************
*** 510,515 ****
--- 518,526 ----
      MoveCursor(_lines - 2, 0);
      if(_termcap_end != NULL)
        tputs(_termcap_end, 1, outchar);
+ 
+     if(_keypad_end != NULL)
+       tputs(_keypad_end, 1, outchar);
  
      if(message){
  	StartInverse();
*** pico/tcap.c.REAL	Thu Dec 21 01:54:35 1995
--- pico/tcap.c	Sat Feb 10 16:08:47 1996
***************
*** 92,98 ****
  	*SF,			/* scroll text up */
  	*SR,			/* scroll text down */
  	*TI,			/* string to start termcap */
!         *TE;			/* string to end termcap */
  
  
  TERM term = {
--- 92,100 ----
  	*SF,			/* scroll text up */
  	*SR,			/* scroll text down */
  	*TI,			/* string to start termcap */
!         *TE,			/* string to end termcap */
! 	*KS,			/* string to enter application keypad mode */
! 	*KE;			/* string to end application keypad mode */
  
  
  TERM term = {
***************
*** 178,183 ****
--- 180,187 ----
      SR = tgetstr("sr", &p);
      TI = tgetstr("ti", &p);
      TE = tgetstr("te", &p);
+     KS = tgetstr("ks", &p);
+     KE = tgetstr("ke", &p);
  
      row = tgetnum("li");
      if(row == -1){
***************
*** 399,404 ****
--- 403,411 ----
  	if (CS)
  	  putpad(tgoto(CS, term.t_nrow, 0)) ;
      }
+ 
+     if(KS && !Pmaster)			/* enter app/keypad mode (cursor) */
+       putpad(KS);
  }
  
  
***************
*** 410,415 ****
--- 417,425 ----
  
  	if(TE)				/* any cleanup termcap requires */
  	  putpad(TE);
+ 
+ 	if(KE)
+ 	  putpad(KE);			/* end app/keypad mode */
      }
  
      kbdestroy(pico_kbesc);		/* clean up key board sequence trie */
