diff options
author | Matt Wozniski <godlygeek@gmail.com> | 2020-10-04 02:37:45 -0400 |
---|---|---|
committer | Matt Wozniski <godlygeek@gmail.com> | 2020-10-05 15:27:04 -0400 |
commit | 2f06413dfb3624381f112b7d8661fde659c279e7 (patch) | |
tree | 59279a7d604e0eae8651dc140d1431e863a9d1a3 /src/nvim/getchar.c | |
parent | f6ac375604238c94d3dc3eeb9b82e67417460806 (diff) | |
download | rneovim-2f06413dfb3624381f112b7d8661fde659c279e7.tar.gz rneovim-2f06413dfb3624381f112b7d8661fde659c279e7.tar.bz2 rneovim-2f06413dfb3624381f112b7d8661fde659c279e7.zip |
Treat unmapped ALT/META as ESC+c in all modes
In #8226 <A-x> and <M-x> were changed to behave like <Esc>x in insert
mode when no mapping exists. This commit backs out that change and
replaces it with a more general one that makes unmapped ALT and META
keypresses as <Esc>+char in all modes. This fixes an unnecessary and
confusing inconsistency between modes.
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index ecb3931b82..cbd9582f8b 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1528,6 +1528,17 @@ int vgetc(void) c = utf_ptr2char(buf); } + // If mappings are enabled (i.e., not Ctrl-v) and the user directly typed + // something with a meta- or alt- modifier that was not mapped, interpret + // <M-x> as <Esc>x rather than as an unbound meta keypress. #8213 + if (!no_mapping && KeyTyped + && (mod_mask == MOD_MASK_ALT || mod_mask == MOD_MASK_META)) { + mod_mask = 0; + stuffcharReadbuff(c); + u_sync(false); + c = ESC; + } + break; } } |