summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-10 21:14:03 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-10 21:14:03 +0200
commit6a0299d8f4c7a64c64d60a6bb39cfe6eaf892247 (patch)
treef90be14b4122755ec33df17f1cfe86bee4ed600a /src/getchar.c
parent07282f01da06c158bab4787adc89ec15d7eeb202 (diff)
patch 8.1.2134: modifier keys are not always recognizedv8.1.2134
Problem: Modifier keys are not always recognized. Solution: Handle key codes generated by xterm with modifyOtherKeys set. Add this to libvterm so we can debug it.
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 85ceddeb4c..ecd6bdcd04 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1733,6 +1733,25 @@ vgetc(void)
case K_XRIGHT: c = K_RIGHT; break;
}
+ if (!no_reduce_keys)
+ {
+ // A modifier was not used for a mapping, apply it to ASCII
+ // keys.
+ if ((mod_mask & MOD_MASK_CTRL)
+ && ((c >= '`' && c <= 0x7f)
+ || (c >= '@' && c <= '_')))
+ {
+ c &= 0x1f;
+ mod_mask &= ~MOD_MASK_CTRL;
+ }
+ if ((mod_mask & (MOD_MASK_META | MOD_MASK_ALT))
+ && c >= 0 && c <= 127)
+ {
+ c += 0x80;
+ mod_mask &= ~MOD_MASK_META;
+ }
+ }
+
// For a multi-byte character get all the bytes and return the
// converted character.
// Note: This will loop until enough bytes are received!