From 77826c2b06442caf48cb5a3aa5c1c1cdc0585fd7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 4 Nov 2018 20:24:34 +0100 Subject: [PATCH] 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. --- src/global.c | 2 +- src/winio.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/global.c b/src/global.c index a7f0d6d0..e339316f 100644 --- 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 index 3194506c..a1331b44 100644 --- 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? */