diff --git a/src/winio.c b/src/winio.c index ead5b018..67ea2432 100644 --- a/src/winio.c +++ b/src/winio.c @@ -369,22 +369,19 @@ int convert_sequence(const int *seq, size_t length, int *consumed) } break; case '2': /* Shift */ - case '4': /* Shift+Alt */ - case '6': /* Shift+Ctrl */ - if (length > 2) { - *consumed = 3; - /* Allow typing digits on the numeric keypad without - * engaging NumLock. Esc O 2 p == Shift-0, .... */ - return (seq[2] - 0x40); - } - break; case '3': /* Alt */ + case '4': /* Shift+Alt */ case '5': /* Ctrl */ + case '6': /* Shift+Ctrl */ case '7': /* Alt+Ctrl */ + case '8': /* Shift+Alt+Ctrl */ if (length > 2) { *consumed = 3; - switch (seq[2]) { + /* Do not accept multiple modifiers. */ + if (seq[1] == '4' || seq[1] > '5') + return FOREIGN_SEQUENCE; #ifndef NANO_TINY + switch (seq[2]) { case 'A': /* Esc O 5 A == Ctrl-Up on Haiku. */ return CONTROL_UP; case 'B': /* Esc O 5 B == Ctrl-Down on Haiku. */ @@ -393,18 +390,12 @@ int convert_sequence(const int *seq, size_t length, int *consumed) return CONTROL_RIGHT; case 'D': /* Esc O 5 D == Ctrl-Left on Haiku. */ return CONTROL_LEFT; -#endif - case 'M': /* Esc O . M == modified Enter on keypad. */ - return KEY_ENTER; - case 'j': /* Esc O . j == modified '*' on keypad. */ - return '*'; - case 'k': /* Esc O . k == modified '+' on keypad. */ - return '+'; - case 'm': /* Esc O . m == modified '-' on keypad. */ - return '-'; - case 'o': /* Esc O . o == modified '/' on keypad. */ - return '/'; } +#endif + /* Translate Shift+digit on the keypad to the digit + * (Esc O 2 p == Shift-0, ...), modifier+operator to + * the operator, and modifier+Enter to CR. */ + return (seq[2] - 0x40); } break; case 'A': /* Esc O A == Up on VT100/VT320. */