From 9b2c2697cbd5915a4527072152611e8e57b420ab Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 23 Dec 2018 19:01:04 +0100 Subject: [PATCH] options: make -d (--rebinddelete) work without -K (--rebindkeypad) When the terminfo selected by TERM does not match the terminal and the key behaves the same as (deleting leftward) or the key behaves the same as (deleting without moving the cursor), then using just -d or --rebinddelete should make the deviant key behave correctly again without affecting the other. --- src/winio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/winio.c b/src/winio.c index a4a3df77..02506113 100644 --- 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 and . */ + 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;