mirror of
https://github.com/neovim/neovim.git
synced 2025-09-26 21:18:34 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user