nano

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

commit 77826c2b06442caf48cb5a3aa5c1c1cdc0585fd7
parent 89760cd6eca6ecbe637dfb4fe12e487e3a59794e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun,  4 Nov 2018 20:24:34 +0100

tweaks: stop setting and requiring the Meta flag for special keycodes

Set the Meta flag only for the regular Meta keystrokes: "M-" plus a
printable ASCII character.  The special keycodes are unique and do
not need any extra flags to differentiate them.

Diffstat:
Msrc/global.c | 2+-
Msrc/winio.c | 9+++------
2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -462,7 +462,7 @@ functionptrtype func_from_key(int *kbinput) void assign_keyinfo(sc *s, const char *keystring, const int keycode) { s->keystr = keystring; - s->meta = (keystring[0] == 'M' && keystring[2] != '\xE2'); + s->meta = (keystring[0] == 'M' && keycode == 0); assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2)); diff --git a/src/winio.c b/src/winio.c @@ -576,10 +576,9 @@ int parse_kbinput(WINDOW *win) return ALT_UP; else if (retval == altdown) return ALT_DOWN; - else if (retval == altdelete) { - meta_key = TRUE; + else if (retval == altdelete) return ALT_DELETE; - } else if (retval == shiftaltleft) { + else if (retval == shiftaltleft) { shift_held = TRUE; return KEY_HOME; } else if (retval == shiftaltright) { @@ -613,10 +612,8 @@ int parse_kbinput(WINDOW *win) if (retval == KEY_DC) { if ((modifiers & 0x05) == 0x05) return CONTROL_SHIFT_DELETE; - if (modifiers == 0x08) { - meta_key = TRUE; + if (modifiers == 0x08) return ALT_DELETE; - } } #endif /* Is Ctrl being held? */