summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-01-28 12:50:43 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-28 12:50:43 +0000
commitfbf4f1ca159028382eaeb3bfc31bb6bb96dbb67a (patch)
treeca12f8ede789ea136c5df6366f20a1ae4f80fffa
parent166788c657f4b1090a31ea37a023b1f2c78790c8 (diff)
downloadvim-git-fbf4f1ca159028382eaeb3bfc31bb6bb96dbb67a.tar.gz
patch 8.2.4237: record buffer wrong if character in Select mode was not typedv8.2.4237
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)
-rw-r--r--src/normal.c7
-rw-r--r--src/testdir/test_registers.vim11
-rw-r--r--src/version.c2
3 files changed, 17 insertions, 3 deletions
diff --git a/src/normal.c b/src/normal.c
index e69c14196..21840369f 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -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';
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index 89d9d7cad..078b78dfd 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 23b29daf3..04afe9586 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4237,
+/**/
4236,
/**/
4235,