aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-01-24 12:46:52 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-01-24 12:46:52 +0800
commit8f1efb018bff6ae95fae62e5ae943d6478e9c547 (patch)
treed3271e67053867e717f0a2e3aec2449196d3a77b /src/nvim/normal.c
parent7e2ce35e3b7f8be5e8d01b44c2fdba0b4e23fbd4 (diff)
downloadrneovim-8f1efb018bff6ae95fae62e5ae943d6478e9c547.tar.gz
rneovim-8f1efb018bff6ae95fae62e5ae943d6478e9c547.tar.bz2
rneovim-8f1efb018bff6ae95fae62e5ae943d6478e9c547.zip
vim-patch:8.2.3993: when recording a change in Select mode char appears twice
Problem: When recording a change in Select mode the first typed character appears twice. Solution: When putting the character back into typeahead remove it from recorded characters. (closes vim/vim#9462) https://github.com/vim/vim/commit/c88e977862ba6477a3b5b28706c45f96069a3073
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index c3b7e81d17..f802dce20d 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1010,7 +1010,12 @@ static int normal_execute(VimState *state, int key)
// restart automatically.
// Insert the typed character in the typeahead buffer, so that it can
// be mapped in Insert mode. Required for ":lmap" to work.
- ins_char_typebuf(s->c, mod_mask);
+ int len = ins_char_typebuf(s->c, mod_mask);
+
+ // When recording the character will be recorded again, remove the
+ // previously recording.
+ ungetchars(len);
+
if (restart_edit != 0) {
s->c = 'd';
} else {