nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit be87f110ce3bcb5ce7dfd5926c8d0088a51f3bcc
parent 9ebee362a51963cb5bf2626c305f024c4d881361
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 27 Nov 2021 16:37:46 +0100

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.

Diffstat:
Msrc/global.c | 3+--
Msrc/winio.c | 3++-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 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 @@ -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;