From be87f110ce3bcb5ce7dfd5926c8d0088a51f3bcc Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 27 Nov 2021 16:37:46 +0100 Subject: [PATCH] bindings: allow rebinding ^Z also on a Linux console (a VT) Achieve this by translating KEY_SUSPEND back to ^Z. (Strictly speaking, this is incorrect, as the terminfo entry might specify some other keystroke for 'kspd', but... meh.) This fixes https://savannah.gnu.org/bugs/?61573. Bug existed since before version 2.2.0, since keys became rebindable. --- src/global.c | 3 +-- src/winio.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/global.c b/src/global.c index db300d0a..096e70e1 100644 --- a/src/global.c +++ b/src/global.c @@ -1497,9 +1497,8 @@ void shortcut_init(void) #ifdef ENABLE_SPELLER add_to_sclist(MMAIN, "F12", KEY_F(12), do_spell, 0); #endif -#if defined(KEY_CANCEL) && defined(KEY_SUSPEND) && defined(KEY_SIC) +#if defined(KEY_CANCEL) && defined(KEY_SIC) add_to_sclist((MMOST & ~MMAIN) | MYESNO, "", KEY_CANCEL, do_cancel, 0); - add_to_sclist(MMAIN|MEXECUTE, "", KEY_SUSPEND, do_suspend, 0); add_to_sclist(MMAIN, "", KEY_SIC, do_insertfile, 0); #endif #ifndef NANO_TINY diff --git a/src/winio.c b/src/winio.c index 571767f7..482413a1 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1244,7 +1244,8 @@ int parse_kbinput(WINDOW *win) case KEY_SCANCEL: return KEY_CANCEL; case KEY_SSUSPEND: - return KEY_SUSPEND; + case KEY_SUSPEND: + return 0x1A; /* The ASCII code for Ctrl+Z. */ case KEY_BTAB: return SHIFT_TAB;