diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-04-04 01:08:07 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-04-04 03:23:15 +0200 |
commit | 224ebc0078f29ac3189d7fbd9a59b386ae2ee303 (patch) | |
tree | d59733a73a7c7202b8badaba95d3f2bcc886ac77 /src/nvim/edit.c | |
parent | 98e71123900fbdf26a16a43297a1f58118cde41b (diff) | |
download | rneovim-224ebc0078f29ac3189d7fbd9a59b386ae2ee303.tar.gz rneovim-224ebc0078f29ac3189d7fbd9a59b386ae2ee303.tar.bz2 rneovim-224ebc0078f29ac3189d7fbd9a59b386ae2ee303.zip |
insert-mode: interpret unmapped META as ESC
closes #2454
closes #8213
ref #7972
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index b772a944f4..117d89d24c 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -847,7 +847,7 @@ static int insert_handle_key(InsertState *s) case ' ': - if (mod_mask != 4) { + if (mod_mask != MOD_MASK_CTRL) { goto normalchar; } // FALLTHROUGH @@ -1180,6 +1180,14 @@ static int insert_handle_key(InsertState *s) normalchar: // Insert a normal character. + + if (mod_mask == MOD_MASK_ALT || mod_mask == MOD_MASK_META) { + // Unmapped ALT/META chord behaves like ESC+c. #8213 + stuffcharReadbuff(ESC); + stuffcharReadbuff(s->c); + break; + } + if (!p_paste) { // Trigger InsertCharPre. char_u *str = do_insert_char_pre(s->c); @@ -1432,7 +1440,7 @@ static void ins_ctrl_v(void) * line and will not removed by the redraw */ edit_unputchar(); clear_showcmd(); - insert_special(c, FALSE, TRUE); + insert_special(c, true, true); revins_chars++; revins_legal++; } @@ -5054,13 +5062,11 @@ static void insert_special(int c, int allow_modmask, int ctrlv) char_u *p; int len; - /* - * Special function key, translate into "<Key>". Up to the last '>' is - * inserted with ins_str(), so as not to replace characters in replace - * mode. - * Only use mod_mask for special keys, to avoid things like <S-Space>, - * unless 'allow_modmask' is TRUE. - */ + // Special function key, translate into "<Key>". Up to the last '>' is + // inserted with ins_str(), so as not to replace characters in replace + // mode. + // Only use mod_mask for special keys, to avoid things like <S-Space>, + // unless 'allow_modmask' is TRUE. if (mod_mask & MOD_MASK_CMD) { // Command-key never produces a normal key. allow_modmask = true; } |