1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-17 18:16:22 -05:00

Fix regression: CSI character instead of ^{[ in terminal special key sequence.

Remove terminal special key conditional compilation.
This commit is contained in:
Renaud 2021-08-06 15:21:00 +08:00
parent 5002897705
commit 4b45ca231e
3 changed files with 18 additions and 34 deletions

View File

@ -3,9 +3,7 @@
#ifndef _ESTRUCT_H_ #ifndef _ESTRUCT_H_
#define _ESTRUCT_H_ #define _ESTRUCT_H_
/* ESTRUCT.H /* Structure and preprocessor defines
*
* Structure and preprocessor defines
* *
* written by Dave G. Conroy * written by Dave G. Conroy
* modified by Steve Wilhite, George Jones * modified by Steve Wilhite, George Jones
@ -66,29 +64,12 @@
#endif #endif
#ifndef AUTOCONF #ifndef AUTOCONF
/* Special keyboard definitions */
#define VT220 0 /* Use keypad escapes P.K. */
#define VT100 0 /* Handle VT100 style keypad. */
/* Terminal Output definitions */ /* Terminal Output definitions */
# define TERMCAP 0 /* Use TERMCAP */
#define ANSI 0 /* ANSI escape sequences */ # define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
#define VT52 0 /* VT52 terminal (Zenith). */
#define TERMCAP 0 /* Use TERMCAP */
#define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
#else #else
# define TERMCAP UNIX
#define VT220 UNIX # define IBMPC MSDOS
#define VT100 0
#define ANSI 0
#define VT52 0
#define TERMCAP UNIX
#define IBMPC MSDOS
#endif /* Autoconf. */ #endif /* Autoconf. */
/* Configuration options */ /* Configuration options */

18
input.c
View File

@ -352,8 +352,8 @@ static int get1unicode( int *up) {
return bytes ; return bytes ;
} }
/* Terminal sequences need up to 6 read ahead characters */ /* Terminal sequences need up to 7 read ahead characters */
#define STACKSIZE 6 #define STACKSIZE 7
static int keystack[ STACKSIZE] ; static int keystack[ STACKSIZE] ;
static int *stackptr = &keystack[ STACKSIZE] ; static int *stackptr = &keystack[ STACKSIZE] ;
#define KPUSH( c) *(--stackptr) = (c) #define KPUSH( c) *(--stackptr) = (c)
@ -381,8 +381,10 @@ int getcmd( void) {
int c ; int c ;
for( ;;) { for( ;;) {
c = get1key() ; c = *(kptr++) = get1key() ;
if( c == (CTRL | '[')) { if( c == 0x9B)
goto foundCSI ;
else if( c == (CTRL | '[')) {
/* fetch terminal sequence */ /* fetch terminal sequence */
c = *(kptr++) = get1key() ; c = *(kptr++) = get1key() ;
if( c == 'O') { /* F1 .. F4 */ if( c == 'O') { /* F1 .. F4 */
@ -390,8 +392,10 @@ int getcmd( void) {
if( c >= 'P' && c <= 'S') if( c >= 'P' && c <= 'S')
return c | SPEC | cmask ; return c | SPEC | cmask ;
} else if( c == '[') { } else if( c == '[') {
int v = 0 ; /* ^[[v1;v~ or ^[[v~ */ int v1, v ; /* ^[[v1;v~ or ^[[v~ */
int v1 = 0 ;
foundCSI:
v1 = v = 0 ;
while( kptr < &keyread[ STACKSIZE]) { while( kptr < &keyread[ STACKSIZE]) {
c = *(kptr++) = get1key() ; c = *(kptr++) = get1key() ;
if( (c == '~') || (c >= 'A' && c <= 'Z')) { if( (c == '~') || (c >= 'A' && c <= 'Z')) {
@ -428,7 +432,7 @@ int getcmd( void) {
while( kptr > keyread) while( kptr > keyread)
KPUSH( *(--kptr)) ; KPUSH( *(--kptr)) ;
c = CTRL | '[' ; c = get1key() ;
} }
if( c == metac) { if( c == metac) {

View File

@ -232,7 +232,7 @@ const name_bind names[] = {
{ NULL, (fnp_t) setmark, META | '.'}, { NULL, (fnp_t) setmark, META | '.'},
// { NULL, bktoshell, META | 'S'}, // { NULL, bktoshell, META | 'S'},
#if VT220 /* special key mapping */
{ NULL, yank, SPEC | '2'}, /* Insert */ { NULL, yank, SPEC | '2'}, /* Insert */
{ NULL, forwdel /* killregion */, SPEC | '3'}, /* Delete */ { NULL, forwdel /* killregion */, SPEC | '3'}, /* Delete */
{ NULL, (fnp_t) backpage, SPEC | '5'}, /* Page Up */ { 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) gotoeob, SPEC | 'F'}, /* End */
{ NULL, (fnp_t) gotobob, SPEC | 'H'}, /* Home */ { NULL, (fnp_t) gotobob, SPEC | 'H'}, /* Home */
{ NULL, help, SPEC | 'P'}, /* F1 */ { NULL, help, SPEC | 'P'}, /* F1 */
#endif
/* hooks */ /* hooks */
{ NULL, nullproc, SPEC | META | 'R'}, /* hook */ { NULL, nullproc, SPEC | META | 'R'}, /* hook */