bindings: hard-bind <Ctrl+Shift+Delete> to 'cutwordleft'

On FreeBSD and NetBSD (when reached through ssh from a Linux machine)
this has the absurd effect of making <Ctrl+Backspace> do a 'cutwordleft'
by default, out of the box, without needing any rebindings.  Weird, but
wonderful, because the ideal behavior.

Also ensure that <Shift+Delete> always does a Backspace.

This makes that we have the following set of "congruent" keys:

  <Tab> moves text to the right,
  <Shift+Tab> moves text to the left,
  <Delete> "eats" a character to the right,
  <Shift+Delete> "eats" a character to the left,
  <Ctrl+Delete> "eats" a word to the right,
  <Shift+Ctrl+Delete> "eats" a word to the left.
master
Benno Schulenberg 2018-09-03 16:11:00 +02:00
parent 3270aac7db
commit e6429e782a
4 changed files with 6 additions and 1 deletions

View File

@ -69,7 +69,7 @@ int didfind = 0;
/* Whether the last search found something. */
int controlleft, controlright, controlup, controldown, controlhome, controlend;
int controldelete;
int controldelete, controlshiftdelete;
#ifndef NANO_TINY
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
int shiftcontrolhome, shiftcontrolend;

View File

@ -2580,6 +2580,7 @@ int main(int argc, char **argv)
controlhome = get_keycode("kHOM5", CONTROL_HOME);
controlend = get_keycode("kEND5", CONTROL_END);
controldelete = get_keycode("kDC5", CONTROL_DELETE);
controlshiftdelete = get_keycode("kDC6", KEY_BACKSPACE);
#ifndef NANO_TINY
/* Ask for the codes for Shift+Control+Left/Right/Up/Down. */
shiftcontrolleft = get_keycode("kLFT6", SHIFT_CONTROL_LEFT);

View File

@ -62,6 +62,7 @@ extern int controldown;
extern int controlhome;
extern int controlend;
extern int controldelete;
extern int controlshiftdelete;
#ifndef NANO_TINY
extern int shiftcontrolleft;
extern int shiftcontrolright;

View File

@ -540,6 +540,8 @@ int parse_kbinput(WINDOW *win)
return CONTROL_END;
else if (retval == controldelete)
return CONTROL_DELETE;
else if (retval == controlshiftdelete)
return the_code_for(do_cut_prev_word, KEY_BACKSPACE);
#ifndef NANO_TINY
else if (retval == shiftcontrolleft) {
shift_held = TRUE;
@ -705,6 +707,7 @@ int parse_kbinput(WINDOW *win)
return KEY_NPAGE;
#ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */
case KEY_SDC:
return KEY_BACKSPACE;
#endif
case DEL_CODE:
if (ISSET(REBIND_DELETE))