From 8f1efb018bff6ae95fae62e5ae943d6478e9c547 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 24 Jan 2022 12:46:52 +0800 Subject: 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 --- src/nvim/normal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/nvim/normal.c') 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 { -- cgit