diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-01-24 15:27:50 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-24 15:27:50 +0000 |
commit | 502d8ae3e8ed8b6f8dd2ff175f154f9aa87228ef (patch) | |
tree | 4f8c375b4f9b90a4d7230ed105224fda7f8f2c48 /src/edit.c | |
parent | acc4b5648b49ec13c4f35ee0bf552eda71b0c372 (diff) |
patch 8.2.4203: entering a character with CTRL-V may include modifiersv8.2.4203
Problem: Entering a character with CTRL-V may include modifiers.
Solution: Reset "mod_mask" when entering a character with digits after
CTRL-V. (closes #9610)
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c index 0363129303..ee3caf0dad 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1909,6 +1909,11 @@ get_literal(int noReduceKeys) if ((nc == ESC || nc == CSI) && !noReduceKeys) nc = decodeModifyOtherKeys(nc); + if ((mod_mask & ~MOD_MASK_SHIFT) != 0) + // A character with non-Shift modifiers should not be a valid + // character for i_CTRL-V_digit. + break; + #ifdef FEAT_CMDL_INFO if (!(State & CMDLINE) && MB_BYTE2LEN_CHECK(nc) == 1) add_to_showcmd(nc); @@ -1986,7 +1991,11 @@ get_literal(int noReduceKeys) --allow_keys; #endif if (nc) + { vungetc(nc); + // A character typed with i_CTRL-V_digit cannot have modifiers. + mod_mask = 0; + } got_int = FALSE; // CTRL-C typed after CTRL-V is not an interrupt return cc; } |