bindings: let the central numpad key (with Ctrl) center the current line

When NumLock is off, let Ctrl plus the central key on the numeric keypad
center the current line.

(This binding is not advertised anywhere
-- it's left as a little Easter egg.)
This commit is contained in:
Benno Schulenberg 2024-07-15 08:28:05 +02:00
parent f69a08fc63
commit 887803cb67
3 changed files with 6 additions and 0 deletions

View File

@ -227,6 +227,9 @@
#define PLANTED_A_COMMAND 0x4EC
#define NO_SUCH_FUNCTION 0x4EF
/* A special keycode for Ctrl + the central key on the numeric keypad. */
#define KEY_CENTER 0x4F0
/* A special keycode to signal the beginning and end of a bracketed paste. */
#define BRACKETED_PASTE_MARKER 0x4FB

View File

@ -1571,6 +1571,7 @@ void shortcut_init(void)
#endif
#ifndef NANO_TINY
add_to_sclist((MMOST & ~MMAIN) | MYESNO, "", KEY_CANCEL, do_cancel, 0);
add_to_sclist(MMAIN, "", KEY_CENTER, do_center, 0);
add_to_sclist(MMAIN, "", KEY_SIC, do_insertfile, 0);
/* Catch and ignore bracketed paste marker keys. */
add_to_sclist(MMOST|MBROWSER|MHELP|MYESNO, "", BRACKETED_PASTE_MARKER, do_nothing, 0);

View File

@ -660,6 +660,8 @@ int convert_CSI_sequence(const int *seq, size_t length, int *consumed)
return CONTROL_RIGHT;
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on xterm. */
return CONTROL_LEFT;
case 'E': /* Esc [ 1 ; 5 E == Ctrl-"Center" on xterm. */
return KEY_CENTER;
case 'F': /* Esc [ 1 ; 5 F == Ctrl-End on xterm. */
return CONTROL_END;
case 'H': /* Esc [ 1 ; 5 H == Ctrl-Home on xterm. */