From cdd68825419d1fa2882f6771b1fb42b97fd189a6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 7 Aug 2020 15:52:35 +0200 Subject: [PATCH] verbatim: insert the full code sequence when is pressed (This could lead to unwanted behavior when the user wants to enter a literal escape character (0x1B) while the input is somehow getting stalled, because then a command keystroke after the M-V would get inserted verbatim too, instead of getting acted upon. But that is a small price to pay for getting the correct behavior for both M-V M-Bsp and M-V M-Enter.) This fixes https://savannah.gnu.org/bugs/?58909. Bug existed since version 2.6.3, commit 08c51cfd, but also occurred erratically beforehand. --- src/winio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/winio.c b/src/winio.c index 4abab8ae..d070e3ad 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1420,9 +1420,9 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count) free(kbinput); - /* If this is an iTerm/Eterm/rxvt double escape, take both Escapes. */ - if (key_buffer_len > 3 && *key_buffer == ESC_CODE && - key_buffer[1] == ESC_CODE && key_buffer[2] == '[') + /* In case of an escape, take also a second code, as it might be another + * escape (on iTerm2/rxvt) or a control code (for M-Bsp and M-Enter). */ + if (key_buffer_len > 1 && *key_buffer == ESC_CODE) *count = 2; return get_input(NULL, *count);