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:
Matt Wozniski
2020-10-04 02:37:45 -04:00
parent f6ac375604
commit 2f06413dfb
9 changed files with 68 additions and 12 deletions

View File

@@ -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;
}
}