nano

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

commit 94b1d01bb4e79d2a82cb0e1c0ac2b133bf7c8f29
parent ac9973658a73440340614d67d9f174b7b096a15a
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon, 21 Apr 2014 18:05:11 +0000

Allowing the codes from Ins and Del keys to be rebound.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4798 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 2++
Mdoc/nanorc.sample.in | 8++++----
Msrc/global.c | 4++--
Msrc/rcfile.c | 6+++++-
4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -16,6 +16,8 @@ * src/global.c (assign_keyinfo, shortcut_init): Give nicer names to the dedicated keys, for when they show up in the help lines. * src/rcfile.c (parse_binding): K-keys no longer exist. + * src/global.c, src/rcfile.c, doc/nanorc.sample.in: Allow the + codes from the Ins and Del keys to be rebound. 2014-04-16 Benno Schulenberg <bensberg@justemail.net> * src/winio.c (get_mouseinput): Properly find also the zeroeth diff --git a/doc/nanorc.sample.in b/doc/nanorc.sample.in @@ -232,13 +232,13 @@ ## Key bindings -## Please see nanorc(5) for more details on this +## Please see nanorc(5) for more details on this. ## -## Here are some samples to get you going +## Here are some samples to get you going. ## # bind M-W nowrap main # bind M-A casesens search # bind ^S research main -## Set this if your backspace key sends delete most of the time (2.1.3+) -# bind kdel backspace all +## Set this if your backspace key sends Del most of the time. +# bind Del backspace all diff --git a/src/global.c b/src/global.c @@ -453,7 +453,7 @@ void assign_keyinfo(sc *s) s->seq = KEY_LEFT; else if (!strcasecmp(s->keystr, "Right")) s->seq = KEY_RIGHT; - else if (!strcasecmp(s->keystr, "Insert")) + else if (!strcasecmp(s->keystr, "Ins")) s->seq = KEY_IC; else if (!strcasecmp(s->keystr, "Del")) s->seq = KEY_DC; @@ -1091,7 +1091,7 @@ void shortcut_init(void) #endif add_to_sclist(MMAIN, "^R", do_insertfile_void, 0, TRUE); add_to_sclist(MMAIN, "F5", do_insertfile_void, 0, TRUE); - add_to_sclist(MMAIN, "Insert", do_insertfile_void, 0, TRUE); + add_to_sclist(MMAIN, "Ins", do_insertfile_void, 0, TRUE); add_to_sclist(MMAIN|MBROWSER, "^W", do_search, 0, TRUE); add_to_sclist(MMAIN|MBROWSER, "F6", do_search, 0, TRUE); add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^Y", do_page_up, 0, TRUE); diff --git a/src/rcfile.c b/src/rcfile.c @@ -499,7 +499,11 @@ void parse_binding(char *ptr, bool dobind) } } - if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') { + /* Allow the codes for Insert and Delete to be rebound, but apart + * from those two only Control, Meta and Function sequences. */ + if (!strcasecmp(keycopy, "Ins") || !strcasecmp(keycopy, "Del")) + keycopy[1] = tolower(keycopy[1]); + else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') { rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\"")); return; }