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.
master
Benno Schulenberg 2018-12-23 19:01:04 +01:00
parent a57c6a6763
commit 9b2c2697cb
1 changed files with 5 additions and 0 deletions

View File

@ -724,6 +724,11 @@ int parse_kbinput(WINDOW *win)
#endif #endif
case KEY_C3: /* PageDown (3) on keypad with NumLock off. */ case KEY_C3: /* PageDown (3) on keypad with NumLock off. */
return KEY_NPAGE; 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. */ #ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */
case KEY_SDC: case KEY_SDC:
return SHIFT_DELETE; return SHIFT_DELETE;