From e6429e782a09092eb87305d5d4cd2831c7129ad7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 3 Sep 2018 16:11:00 +0200 Subject: [PATCH] bindings: hard-bind to 'cutwordleft' On FreeBSD and NetBSD (when reached through ssh from a Linux machine) this has the absurd effect of making do a 'cutwordleft' by default, out of the box, without needing any rebindings. Weird, but wonderful, because the ideal behavior. Also ensure that always does a Backspace. This makes that we have the following set of "congruent" keys: moves text to the right, moves text to the left, "eats" a character to the right, "eats" a character to the left, "eats" a word to the right, "eats" a word to the left. --- src/global.c | 2 +- src/nano.c | 1 + src/proto.h | 1 + src/winio.c | 3 +++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/global.c b/src/global.c index 431a2097..475addbe 100644 --- a/src/global.c +++ b/src/global.c @@ -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; diff --git a/src/nano.c b/src/nano.c index cca042cb..c7e0ca2d 100644 --- a/src/nano.c +++ b/src/nano.c @@ -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); diff --git a/src/proto.h b/src/proto.h index 3a1f5025..fd059b31 100644 --- a/src/proto.h +++ b/src/proto.h @@ -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; diff --git a/src/winio.c b/src/winio.c index 6908ee1d..cf8e8376 100644 --- a/src/winio.c +++ b/src/winio.c @@ -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))