nano

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

commit 1ca1732d3217589dfbf1dc983680c24099b5e764
parent accd2308f1fbb2c1f1a7c3535a9d61a2b5de7628
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 29 Jan 2022 16:32:04 +0100

tweaks: remove a redundant check -- add a different one for symmetry

Function get_input() with a non-null parameter will never return ERR.

Diffstat:
Msrc/winio.c | 5+----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -929,9 +929,6 @@ int parse_kbinput(WINDOW *win) /* Get one code from the input stream. */ keycode = get_input(win); - if (keycode == ERR) - return ERR; - /* For an Esc, remember whether the last two arrived by themselves. * Then increment the counter, rolling around on three escapes. */ if (keycode == ESC_CODE) { @@ -1417,7 +1414,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count) #endif /* For an invalid digit, discard its possible continuation bytes. */ if (unicode == INVALID_DIGIT) { - if (keycode == ESC_CODE) { + if (keycode == ESC_CODE && waiting_codes) { get_input(NULL); while (waiting_codes && 0x1F < nextcodes[0] && nextcodes[0] < 0x40) get_input(NULL);