diff --git a/src/nano.c b/src/nano.c index c1955b76d5f3e9b20cdb72f6516c3260d80a3e83..0d5cc4719093e054a795e9b0268606e1488d0801 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2523,6 +2523,11 @@ int main(int argc, char **argv) controlright = key_defined(keyvalue); #endif +#ifndef USE_SLANG + /* Tell ncurses to pass the Esc key quickly. */ + set_escdelay(50); +#endif + #ifdef DEBUG fprintf(stderr, "Main: open file\n"); #endif diff --git a/src/winio.c b/src/winio.c index 3717d87ed8caf59bd3c9bbb872a379d33706a09d..5483aad02130ff396a2c3abb4ee14a022fa53423 100644 --- a/src/winio.c +++ b/src/winio.c @@ -40,6 +40,8 @@ static int *key_buffer = NULL; * haven't handled yet at a given point. */ static size_t key_buffer_len = 0; /* The length of the keystroke buffer. */ +static bool solitary = FALSE; + /* Whether an Esc arrived by itself -- not as leader of a sequence. */ static int statusblank = 0; /* The number of keystrokes left before we blank the statusbar. */ static bool suppress_cursorpos = FALSE; @@ -362,6 +364,7 @@ int parse_kbinput(WINDOW *win) /* If there are four consecutive escapes, discard three of them. */ if (escapes > 3) escapes = 1; + solitary = (escapes == 1 && get_key_buffer_len() == 0); /* Wait for more input. */ break; default: @@ -377,7 +380,8 @@ int parse_kbinput(WINDOW *win) get_key_buffer_len() == 0 || *key_buffer == 0x1B) { /* One escape followed by a single non-escape: * meta key sequence mode. */ - meta_key = TRUE; + if (!solitary || (*kbinput >= 0x20 && *kbinput < 0x7F)) + meta_key = TRUE; retval = tolower(*kbinput); } else /* One escape followed by a non-escape, and there