0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.4237: record buffer wrong if character in Select mode was not 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)
This commit is contained in:
zeertzjq 2022-01-28 12:50:43 +00:00 committed by Bram Moolenaar
parent 166788c657
commit fbf4f1ca15
3 changed files with 17 additions and 3 deletions

View File

@ -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';

View File

@ -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

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4237,
/**/
4236,
/**/