diff --git a/estruct.h b/estruct.h index 22d1e7b..a5c2ae5 100644 --- a/estruct.h +++ b/estruct.h @@ -3,13 +3,11 @@ #ifndef _ESTRUCT_H_ #define _ESTRUCT_H_ -/* ESTRUCT.H - * - * Structure and preprocessor defines +/* Structure and preprocessor defines * * written by Dave G. Conroy * modified by Steve Wilhite, George Jones - * substantially modified by Daniel Lawrence + * substantially modified by Daniel Lawrence * modified by Petri Kutvonen */ @@ -66,29 +64,12 @@ #endif #ifndef AUTOCONF - -/* Special keyboard definitions */ - -#define VT220 0 /* Use keypad escapes P.K. */ -#define VT100 0 /* Handle VT100 style keypad. */ - /* Terminal Output definitions */ - -#define ANSI 0 /* ANSI escape sequences */ -#define VT52 0 /* VT52 terminal (Zenith). */ -#define TERMCAP 0 /* Use TERMCAP */ -#define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */ - +# define TERMCAP 0 /* Use TERMCAP */ +# define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */ #else - -#define VT220 UNIX -#define VT100 0 - -#define ANSI 0 -#define VT52 0 -#define TERMCAP UNIX -#define IBMPC MSDOS - +# define TERMCAP UNIX +# define IBMPC MSDOS #endif /* Autoconf. */ /* Configuration options */ diff --git a/input.c b/input.c index d324251..ae0b958 100644 --- a/input.c +++ b/input.c @@ -352,8 +352,8 @@ static int get1unicode( int *up) { return bytes ; } -/* Terminal sequences need up to 6 read ahead characters */ -#define STACKSIZE 6 +/* Terminal sequences need up to 7 read ahead characters */ +#define STACKSIZE 7 static int keystack[ STACKSIZE] ; static int *stackptr = &keystack[ STACKSIZE] ; #define KPUSH( c) *(--stackptr) = (c) @@ -381,8 +381,10 @@ int getcmd( void) { int c ; for( ;;) { - c = get1key() ; - if( c == (CTRL | '[')) { + c = *(kptr++) = get1key() ; + if( c == 0x9B) + goto foundCSI ; + else if( c == (CTRL | '[')) { /* fetch terminal sequence */ c = *(kptr++) = get1key() ; if( c == 'O') { /* F1 .. F4 */ @@ -390,8 +392,10 @@ int getcmd( void) { if( c >= 'P' && c <= 'S') return c | SPEC | cmask ; } else if( c == '[') { - int v = 0 ; /* ^[[v1;v~ or ^[[v~ */ - int v1 = 0 ; + int v1, v ; /* ^[[v1;v~ or ^[[v~ */ + + foundCSI: + v1 = v = 0 ; while( kptr < &keyread[ STACKSIZE]) { c = *(kptr++) = get1key() ; if( (c == '~') || (c >= 'A' && c <= 'Z')) { @@ -428,7 +432,7 @@ int getcmd( void) { while( kptr > keyread) KPUSH( *(--kptr)) ; - c = CTRL | '[' ; + c = get1key() ; } if( c == metac) { diff --git a/names.c b/names.c index f357a99..ae7c45a 100644 --- a/names.c +++ b/names.c @@ -232,7 +232,7 @@ const name_bind names[] = { { NULL, (fnp_t) setmark, META | '.'}, // { NULL, bktoshell, META | 'S'}, -#if VT220 +/* special key mapping */ { NULL, yank, SPEC | '2'}, /* Insert */ { NULL, forwdel /* killregion */, SPEC | '3'}, /* Delete */ { NULL, (fnp_t) backpage, SPEC | '5'}, /* Page Up */ @@ -244,7 +244,6 @@ const name_bind names[] = { { NULL, (fnp_t) gotoeob, SPEC | 'F'}, /* End */ { NULL, (fnp_t) gotobob, SPEC | 'H'}, /* Home */ { NULL, help, SPEC | 'P'}, /* F1 */ -#endif /* hooks */ { NULL, nullproc, SPEC | META | 'R'}, /* hook */