nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 8dc1b974650325704f4086a9ff3eaff5f6e6368f
parent 350115242d1c5db12c02f0b181434a273421f73e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 24 Jul 2020 13:38:44 +0200

tweaks: three escapes is the same as either zero escapes or one escape

Diffstat:
Msrc/winio.c | 26++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -925,14 +925,15 @@ int parse_kbinput(WINDOW *win) if (keycode == ERR) return ERR; - /* If it is an ESC, increment the counter, but trim an overabundance. */ + /* Remember whether an Esc arrived by itself, and increment + * its counter, rolling around on three escapes. */ if (keycode == ESC_CODE) { - if (++escapes > 3 || digit_count > 0) { + solitary = (key_buffer_len == 0); + if (digit_count > 0) { digit_count = 0; escapes = 1; - } - /* Take note when an Esc arrived by itself. */ - solitary = (key_buffer_len == 0); + } else if (++escapes > 2) + escapes = (solitary ? 0 : 1); return ERR; } @@ -1028,21 +1029,6 @@ int parse_kbinput(WINDOW *win) } escapes = 0; break; - case 3: - if (key_buffer_len == 0) { - if (!solitary) { - meta_key = TRUE; - retval = (shifted_metas) ? keycode : tolower(keycode); - } else - /* Three escapes followed by a non-escape, and no - * other codes are waiting: normal input mode. */ - retval = keycode; - } else - /* Three escapes followed by a non-escape, and more - * codes are waiting: escape sequence mode. */ - retval = parse_escape_sequence(keycode); - escapes = 0; - break; } if (retval == controlleft)