Skip to content

Commit

Permalink
patch 8.2.4237: record buffer wrong if character in Select mode was n…
Browse files Browse the repository at this point in the history
…ot typed

Problem:    Record buffer wrong if character in Select mode was not typed.
Solution:   Only delete the tail from the record buffer if the character was
            typed. (closes #9650)
  • Loading branch information
zeertzjq authored and brammool committed Jan 28, 2022
1 parent 166788c commit fbf4f1c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,10 @@ normal_cmd(
// be mapped in Insert mode. Required for ":lmap" to work.
len = ins_char_typebuf(vgetc_char, vgetc_mod_mask);

// When recording the character will be recorded again, remove the
// previously recording.
ungetchars(len);
// When recording and gotchars() was called the character will be
// recorded again, remove the previous recording.
if (KeyTyped)
ungetchars(len);

if (restart_edit != 0)
c = 'd';
Expand Down
11 changes: 11 additions & 0 deletions src/testdir/test_registers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,17 @@ func Test_record_in_select_mode()
sil norm q00
sil norm q
call assert_equal('0ext', getline(1))

%delete
let @r = ''
call setline(1, ['abc', 'abc', 'abc'])
smap <F2> <Right><Right>,
call feedkeys("qrgh\<F2>Dk\<Esc>q", 'xt')
call assert_equal("gh\<F2>Dk\<Esc>", @r)
norm j0@rj0@@
call assert_equal([',Dk', ',Dk', ',Dk'], getline(1, 3))
sunmap <F2>

bwipe!
endfunc

Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4237,
/**/
4236,
/**/
Expand Down

0 comments on commit fbf4f1c

Please sign in to comment.