diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-01-25 07:37:28 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-01-25 08:21:20 +0800 |
commit | 3d9ff675f8135be6ef17df4da07781cd05dbcd55 (patch) | |
tree | 7cb6761d4da9f316eb0839a34688cbf01d871993 /src/nvim/edit.c | |
parent | 1b6ae2dbb0aa24748d44752407cd18b5abec1d0a (diff) | |
download | rneovim-3d9ff675f8135be6ef17df4da07781cd05dbcd55.tar.gz rneovim-3d9ff675f8135be6ef17df4da07781cd05dbcd55.tar.bz2 rneovim-3d9ff675f8135be6ef17df4da07781cd05dbcd55.zip |
vim-patch:8.2.4203: entering a character with CTRL-V may include modifiers
Problem: Entering a character with CTRL-V may include modifiers.
Solution: Reset "mod_mask" when entering a character with digits after
CTRL-V. (closes vim/vim#9610)
https://github.com/vim/vim/commit/502d8ae3e8ed8b6f8dd2ff175f154f9aa87228ef
Commenting out test_override() as before.
Commenting out part of CheckNotFeature() because Vim patch 8.2.0427
cannot be ported without breaking a lot of oldtests that check for
removed features.
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index a9c606ec13..f3226d4f6c 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -5631,8 +5631,12 @@ int get_literal(void) i = 0; for (;;) { nc = plain_vgetc(); - if (!(State & CMDLINE) - && MB_BYTE2LEN_CHECK(nc) == 1) { + 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; + } + if (!(State & CMDLINE) && MB_BYTE2LEN_CHECK(nc) == 1) { add_to_showcmd(nc); } if (nc == 'x' || nc == 'X') { @@ -5698,6 +5702,8 @@ int get_literal(void) --no_mapping; 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; |