nano

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

commit 9b2c2697cbd5915a4527072152611e8e57b420ab
parent a57c6a6763f31dfaf52dc392b4e6127a2c3e88e3
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 23 Dec 2018 19:01:04 +0100

options: make -d (--rebinddelete) work without -K (--rebindkeypad)

When the terminfo selected by TERM does not match the terminal and
the <Delete> key behaves the same as <Backspace> (deleting leftward)
or the <Backspace> key behaves the same as <Delete> (deleting without
moving the cursor), then using just -d or --rebinddelete should make
the deviant key behave correctly again without affecting the other.

Diffstat:
Msrc/winio.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -724,6 +724,11 @@ int parse_kbinput(WINDOW *win) #endif case KEY_C3: /* PageDown (3) on keypad with NumLock off. */ return KEY_NPAGE; + /* When requested, swap meanings of keycodes for <Bsp> and <Del>. */ + case KEY_BACKSPACE: + return (ISSET(REBIND_DELETE) ? KEY_DC : KEY_BACKSPACE); + case KEY_DC: + return (ISSET(REBIND_DELETE) ? KEY_BACKSPACE : KEY_DC); #ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */ case KEY_SDC: return SHIFT_DELETE;