bindings: allow typing digits on the numeric keypad by holding Shift

Until now, on an xterm, Shift plus any keypad key would say
"Unknown sequence", which is not useful.  On other terminal
emulators (urxvt, Pantheon, LXTerminal), Shift plus a keypad
key already produces the relevant digit or symbol, so this
change harmonizes the behavior of the different emulators.

However, on a Linux console, Shift plus a keypad key moves
the cursor and selects the text that is passed over.  And
holding Alt while pressing a keypad key does nothing at all.
master
Benno Schulenberg 2020-07-09 20:55:37 +02:00
parent ecb4dac494
commit 476c838753
1 changed files with 11 additions and 4 deletions

View File

@ -368,12 +368,19 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
/* ->->->->->->-> */
}
break;
case '2':
if (length > 2)
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':
case '5':
case '3': /* Alt */
case '5': /* Ctrl */
case '7': /* Alt+Ctrl */
if (length > 2) {
*consumed = 3;
switch (seq[2]) {