aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2020-10-05 22:07:52 -0400
committerGitHub <noreply@github.com>2020-10-05 22:07:52 -0400
commit27b811dc1f69a31924ddcd3c0a3cbbe138923c96 (patch)
treed0df14412fe12859ae57ed3dde2846c7d80c0b40 /src/nvim/getchar.c
parentf8a5b4bdce489f4df7df15d0b363b608853b92d6 (diff)
parent2f06413dfb3624381f112b7d8661fde659c279e7 (diff)
downloadrneovim-27b811dc1f69a31924ddcd3c0a3cbbe138923c96.tar.gz
rneovim-27b811dc1f69a31924ddcd3c0a3cbbe138923c96.tar.bz2
rneovim-27b811dc1f69a31924ddcd3c0a3cbbe138923c96.zip
Merge pull request #13042 from godlygeek/unmapped_meta_is_esc
Treat unmapped ALT/META as ESC+c in all modes Closes #7972
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c11
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;
}
}