commit 887803cb674b0b8664b37a5dd7a279919e727047
parent f69a08fc63876e454459ef038c7ccc797f175b08
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 15 Jul 2024 08:28:05 +0200
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.)
Diffstat:
3 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/definitions.h b/src/definitions.h
@@ -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
diff --git a/src/global.c b/src/global.c
@@ -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);
diff --git a/src/winio.c b/src/winio.c
@@ -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. */