From 7e53fcb581b1f25ba863b82aa799fa6724d70ef1 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 21 Jul 2020 13:46:21 +0200 Subject: [PATCH] tweaks: remove two redundant conditions, and make a more direct return The escape-parsing routine nowadays returns FOREIGN_SEQUENCE instead of ERR when encountering an unknown sequence. So, with the two cases that demand ERR now handled directly, there is no need to check for ERR any more. --- src/winio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/winio.c b/src/winio.c index 2af5e32c..a0070b23 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1026,11 +1026,11 @@ int parse_kbinput(WINDOW *win) } escapes = 0; } - } else if (keycode == '[' && key_buffer_len > 0 && - (('A' <= *key_buffer && *key_buffer <= 'D') || - ('a' <= *key_buffer && *key_buffer <= 'd'))) { + } else if (keycode == '[' && (('A' <= *key_buffer && *key_buffer <= 'D') || + ('a' <= *key_buffer && *key_buffer <= 'd'))) { /* An iTerm2/Eterm/rxvt sequence: ^[ ^[ [ X. */ double_esc = TRUE; + return ERR; } else { /* Two escapes followed by a non-escape, and there are more * codes waiting: combined meta and escape sequence mode. */ @@ -1058,9 +1058,6 @@ int parse_kbinput(WINDOW *win) break; } - if (retval == ERR) - return ERR; - if (retval == controlleft) return CONTROL_LEFT; else if (retval == controlright)