[comp.mail.elm] vt100 cursor fix for elm

mike@ists (Mike Clarkson) (05/08/88)

Here are a couple of changes for elm 1.7beta.

1) The screen is not redrawn after entering an editor.  That works for
vi, but not for microemacs.  redraw is now set for edit and forward.

2) The cursor keys are only checked for the first character after an 
escape for a cursor movement.  This won't work for a vt100, so the patch
makes it look for the second character after an escape iff the first
char. is the same for cursor up and cursor down (I know groddy groddy).

Feed to patch.

-------------------------------------------------------------------------------

*** elm.c.old
--- elm.c
**************
*** 222,228
  
  	    case 'e'    :  PutLine0(LINES-3,strlen("Command: "),"Edit mailbox");
  			   if (current > 0) {
! 			     edit_mailbox();
  	    		     if (cursor_control)
  	                       transmit_functions(ON);	/* insurance */
  	   		   }
--- 222,228 -----
  
  	    case 'e'    :  PutLine0(LINES-3,strlen("Command: "),"Edit mailbox");
  			   if (current > 0) {
! 			     redraw = edit_mailbox();
  	    		     if (cursor_control)
  	                       transmit_functions(ON);	/* insurance */
  	   		   }
**************
*** 232,238
  		
  	    case 'f'    :  PutLine0(LINES-3, strlen("Command: "), "Forward");
  			   define_softkeys(YESNO);
! 			   if (current > 0)  
  	                     redraw = forward();   
  			   else 
  	                     error("No mail to forward!");
--- 232,238 -----
  		
  	    case 'f'    :  PutLine0(LINES-3, strlen("Command: "), "Forward");
  			   define_softkeys(YESNO);
! 			   if (current > 0)  {
  	                     redraw = forward();   
  			     redraw++;
  			     }
**************
*** 234,239
  			   define_softkeys(YESNO);
  			   if (current > 0)  
  	                     redraw = forward();   
  			   else 
  	                     error("No mail to forward!");
  			   define_softkeys(MAIN);
--- 234,241 -----
  			   define_softkeys(YESNO);
  			   if (current > 0)  {
  	                     redraw = forward();   
+ 			     redraw++;
+ 			     }
  			   else 
  	                     error("No mail to forward!");
  			   define_softkeys(MAIN);
**************
*** 454,460
  
  	    case NO_OP_COMMAND : break;	/* noop for timeout loop */
  
! 	    case ESCAPE : if (cursor_control) {
  			    ch = ReadCh(); 
  	                    if (ch == up[1]) {
  			      if (selected)
--- 456,463 -----
  
  	    case NO_OP_COMMAND : break;	/* noop for timeout loop */
  
! 	    case ESCAPE : 
! 			if (cursor_control > 0) {
  			    ch = ReadCh(); 
  			    i = 1;
  			    if ( up[i] == down[i] ) {
**************
*** 456,462
  
  	    case ESCAPE : if (cursor_control) {
  			    ch = ReadCh(); 
! 	                    if (ch == up[1]) {
  			      if (selected)
  			        current = previous_visible(current);
  			      else 
--- 459,471 -----
  	    case ESCAPE : 
  			if (cursor_control > 0) {
  			    ch = ReadCh(); 
! 			    i = 1;
! 			    if ( up[i] == down[i] ) {
! 				   /* Ansi or vt100 escape sequence */
! 				    ch = ReadCh(); 
! 				    i++;
! 				}
! 	                    if (ch == up[i]) {
  			      if (selected)
  			        current = previous_visible(current);
  			      else 
**************
*** 466,472
  			      else
  			        nucurr++;			
  	                    }
! 			    else if (ch == down[1]) {
  			      if (selected) {
  			        if ((current = next_visible(current)) < 0)
  	                          current = visible_to_index(selected)+1;
--- 475,481 -----
  			      else
  			        nucurr++;			
  	                    }
! 			    else if (ch == down[i]) {
  			      if (selected) {
  			        if ((current = next_visible(current)) < 0)
  	                          current = visible_to_index(selected)+1;

-- 
Mike Clarkson					mike@ists.UUCP
Institute for Space and Terrestrial Science	mike@ists.yorku.ca
York University, North York, Ontario,		uunet!mnetor!yunexus!ists!mike
CANADA M3J 1P3					+1 (416) 736-5611

mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) (05/09/88)

> 2) The cursor keys are only checked for the first character after an 
> escape for a cursor movement.  This won't work for a vt100, so the patch
> makes it look for the second character after an escape iff the first
> char. is the same for cursor up and cursor down (I know groddy groddy).

Instead of special case code for HP terminals (Dave Taylor's environment)
and every user putting in special hacks for favorite terminals, Elm should
really be made to use termcap/termio correctly and do things right.  Vi
does it, emacs does it, Mush does it, why doesn't elm?

Mike Khaw
-- 
internet: mkhaw@teknowledge.arpa
uucp:	  {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge-vaxc.arpa
hardcopy: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303

jv@mhres.mh.nl (Johan Vromans) (05/10/88)

From article <22356@teknowledge-vaxc.ARPA:, by mkhaw@teknowledge-vaxc.ARPA (Mike Khaw):
: Instead of special case code for HP terminals (Dave Taylor's environment)
: and every user putting in special hacks for favorite terminals, Elm should
: really be made to use termcap/termio correctly and do things right.  Vi
: does it, emacs does it, Mush does it, why doesn't elm?

Volunteers?
-- 
Johan Vromans                              | jv@mh.nl via European backbone
Multihouse N.V., Gouda, the Netherlands    | uucp: ..{uunet!}mcvax!mh.nl!jv
"It is better to light a candle than to curse the darkness"