From a33b04ce903260762888200716d176747de18a54 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 24 Jul 2020 17:08:53 +0200 Subject: [PATCH] tweaks: cascade the ifs properly: without increasing the indentation --- src/winio.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/winio.c b/src/winio.c index 1004f7f1..d0337d2e 100644 --- a/src/winio.c +++ b/src/winio.c @@ -984,8 +984,7 @@ int parse_kbinput(WINDOW *win) (keycode == '[' || keycode == 'O')) { retval = parse_escape_sequence(keycode); meta_key = TRUE; - } else { - if ('0' <= keycode && (keycode <= '2' || + } else if ('0' <= keycode && (keycode <= '2' || (keycode <= '9' && digit_count > 0))) { /* Two escapes followed by one digit, and no other codes * are waiting: byte sequence mode. If the range of the @@ -1011,22 +1010,15 @@ int parse_kbinput(WINDOW *win) #endif else retval = byte; - } else { - if (digit_count > 0) + } else if (digit_count > 0) { /* A non-digit in the middle of a byte sequence: * the keycode itself is the result. */ retval = keycode; - else { - /* Two escapes followed by a non-digit: meta key - * or control character sequence mode. */ - if (!solitary) { + } else if (!solitary) { meta_key = TRUE; retval = (shifted_metas) ? keycode : tolower(keycode); - } else + } else retval = convert_to_control(keycode); - } - } - } escapes = 0; break; }