diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2016-01-11 00:48:28 -0500 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2016-01-11 00:48:28 -0500 |
| commit | 3b94756feb39ad269104b2f765c6c56ff2360203 (patch) | |
| tree | ae1e784bfc3755f4075e8b12564732d21f92a40b /src/nvim/keymap.c | |
| parent | 223aafb1a75c9ece9a2283a887b7539a3b771550 (diff) | |
| parent | 317d5ca7b0f92ef42de989b3556ca9503f0a3bf6 (diff) | |
| download | rneovim-3b94756feb39ad269104b2f765c6c56ff2360203.tar.gz rneovim-3b94756feb39ad269104b2f765c6c56ff2360203.tar.bz2 rneovim-3b94756feb39ad269104b2f765c6c56ff2360203.zip | |
Merge pull request #3982 from justinmk/nohighbit
input: Do not set high-bit. Preserve META modifier.
Diffstat (limited to 'src/nvim/keymap.c')
| -rw-r--r-- | src/nvim/keymap.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 04d6cbf5e3..b2fd929714 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -18,6 +18,9 @@ #include "nvim/strings.h" #include "nvim/mouse.h" +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "keymap.c.generated.h" +#endif /* * Some useful tables. @@ -637,11 +640,11 @@ find_special_key ( key = DEL; } - /* - * Normal Key with modifier: Try to make a single byte code. - */ - if (!IS_SPECIAL(key)) + // Normal Key with modifier: + // Try to make a single byte code (except for Alt/Meta modifiers). + if (!IS_SPECIAL(key)) { key = extract_modifiers(key, &modifiers); + } *modp = modifiers; *srcp = end_of_name; @@ -652,11 +655,9 @@ find_special_key ( return 0; } -/* - * Try to include modifiers in the key. - * Changes "Shift-a" to 'A', "Alt-A" to 0xc0, etc. - */ -int extract_modifiers(int key, int *modp) +/// Try to include modifiers (except alt/meta) in the key. +/// Changes "Shift-a" to 'A', "Ctrl-@" to <Nul>, etc. +static int extract_modifiers(int key, int *modp) { int modifiers = *modp; @@ -665,19 +666,12 @@ int extract_modifiers(int key, int *modp) modifiers &= ~MOD_MASK_SHIFT; } if ((modifiers & MOD_MASK_CTRL) - && ((key >= '?' && key <= '_') || ASCII_ISALPHA(key)) - ) { + && ((key >= '?' && key <= '_') || ASCII_ISALPHA(key))) { key = Ctrl_chr(key); modifiers &= ~MOD_MASK_CTRL; - /* <C-@> is <Nul> */ - if (key == 0) + if (key == 0) { // <C-@> is <Nul> key = K_ZERO; - } - if ((modifiers & MOD_MASK_ALT) && key < 0x80 - && !enc_dbcs /* avoid creating a lead byte */ - ) { - key |= 0x80; - modifiers &= ~MOD_MASK_ALT; /* remove the META modifier */ + } } *modp = modifiers; |
