commit 363a4378b752020ff91f2a1db5d8a58c45274c32
parent f70f52873058b5a69b466106e0cc88850da45ea0
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 11 May 2024 12:04:04 +0200
input: provide for urxvt setting a high bit or sending an extra escape
When pressing Alt+Home/Alt+End on urxvt, urxvt either sets the high bit
of the last byte in the sequence for Home/End (when Meta8 is True), or
sends an extra escape before that same sequence (when Meta8 is False).
Accommodate for this bug by recognizing the produced code sequences.
Indirectly-reported-by: Sébastien Desreux <seb@h-k.fr>
https://lists.gnu.org/archive/html/nano-devel/2024-05/msg00007.html
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -825,6 +825,8 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
#ifndef NANO_TINY
else if (length > 1 && seq[1] == '@')
return shiftcontrolhome;
+ else if (length > 1 && seq[1] == 0xFE)
+ return ALT_HOME;
#endif
break;
case '8': /* Esc [ 8 ~ == End on Eterm/rxvt;
@@ -840,6 +842,8 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
#ifndef NANO_TINY
else if (length > 1 && seq[1] == '@')
return shiftcontrolend;
+ else if (length > 1 && seq[1] == 0xFE)
+ return ALT_END;
#endif
break;
case '9': /* Esc [ 9 == Delete on Mach console. */
@@ -1052,6 +1056,12 @@ int parse_kbinput(WINDOW *frame)
#endif
else if (keycode < 0x20 && !last_escape_was_alone)
meta_key = TRUE;
+#ifndef NANO_TINY
+ else if (keycode == KEY_HOME)
+ return ALT_HOME;
+ else if (keycode == KEY_END)
+ return ALT_END;
+#endif
} else if (waiting_codes == 0 || nextcodes[0] == ESC_CODE ||
(keycode != 'O' && keycode != '[')) {
if (!shifted_metas)