commit 4c63ef204d86d9bfd91bb740a4061d4c9ad9b950
parent 4c6b6cad99175b95705922e56ae2ec42270f6e8f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 5 Aug 2020 11:03:35 +0200
tweaks: make a few more direct returns, and reshuffle another bit of code
Diffstat:
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -967,10 +967,10 @@ int parse_kbinput(WINDOW *win)
case 'C': return CONTROL_RIGHT;
case 'D': return CONTROL_LEFT;
#ifndef NANO_TINY
- case 'a': keycode = shiftaltup; break;
- case 'b': keycode = shiftaltdown; break;
- case 'c': keycode = shiftaltright; break;
- case 'd': keycode = shiftaltleft; break;
+ case 'a': shift_held = TRUE; return KEY_PPAGE;
+ case 'b': shift_held = TRUE; return KEY_NPAGE;
+ case 'c': shift_held = TRUE; return KEY_HOME;
+ case 'd': shift_held = TRUE; return KEY_END;
#endif
}
} else if (key_buffer_len > 0 && *key_buffer != ESC_CODE &&
@@ -1004,15 +1004,16 @@ int parse_kbinput(WINDOW *win)
keycode = byte;
else
return byte;
- } else if (digit_count > 0) {
- /* A non-digit in the middle of a byte sequence... */
- ;
- } else if (!solitary) {
- if (!shifted_metas)
- keycode = tolower(keycode);
- meta_key = TRUE;
- } else
- keycode = convert_to_control(keycode);
+ } else if (digit_count == 0) {
+ /* If the second escape did not arrive alone, it is a Meta
+ * keystroke; otherwise, it is an "Esc Esc control". */
+ if (!solitary) {
+ if (!shifted_metas)
+ keycode = tolower(keycode);
+ meta_key = TRUE;
+ } else
+ keycode = convert_to_control(keycode);
+ }
}
if (keycode == controlleft)