input: simplify a bit of code, reducing a four-case switch to a single if
parent
97e9849d6c
commit
a7c158d07d
17
src/winio.c
17
src/winio.c
|
@ -346,19 +346,10 @@ int parse_kbinput(WINDOW *win)
|
||||||
case NANO_CONTROL_3:
|
case NANO_CONTROL_3:
|
||||||
/* Increment the escape counter. */
|
/* Increment the escape counter. */
|
||||||
escapes++;
|
escapes++;
|
||||||
switch (escapes) {
|
/* If there are four consecutive escapes, discard three of them. */
|
||||||
case 1:
|
if (escapes > 3)
|
||||||
/* One escape: wait for more input. */
|
escapes = 1;
|
||||||
case 2:
|
/* Wait for more input. */
|
||||||
/* Two escapes: wait for more input. */
|
|
||||||
case 3:
|
|
||||||
/* Three escapes: wait for more input. */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* More than three escapes: limit the escape counter
|
|
||||||
* to no more than two, and wait for more input. */
|
|
||||||
escapes %= 3;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch (escapes) {
|
switch (escapes) {
|
||||||
|
|
Loading…
Reference in New Issue