0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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 #9462)
This commit is contained in:
Bram Moolenaar
2022-01-03 13:47:50 +00:00
parent 0e2508d9e6
commit c88e977862
5 changed files with 69 additions and 11 deletions

View File

@@ -592,12 +592,19 @@ normal_cmd(
&& VIsual_select
&& (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER))
{
int len;
// Fake a "c"hange command. When "restart_edit" is set (e.g., because
// 'insertmode' is set) fake a "d"elete command, Insert mode will
// 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(vgetc_char, vgetc_mod_mask);
len = ins_char_typebuf(vgetc_char, vgetc_mod_mask);
// When recording the character will be recorded again, remove the
// previously recording.
ungetchars(len);
if (restart_edit != 0)
c = 'd';
else