patch 9.1.1858: v:register not reset after Visual mode command
Commit:
https://github.com/vim/vim/commit/b3b47e540d35742503ea372c5a97e8fb5681ab26
Author: zeertzjq <[email protected]>
Date: Thu Oct 16 18:17:45 2025 +0000
patch 9.1.1858: v:register not reset after Visual mode command
Problem: v:register not reset after Visual mode command.
(laktak)
Solution: Reset v:register if Visual mode was active before
do_pending_operator() (zeertzjq)
fixes: #18579
related: #5305
closes: #18583
Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/normal.c b/src/normal.c
index 3b9934017..ead265dc2 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -968,6 +968,10 @@ normal_cmd(
if (old_mapped_len > 0)
old_mapped_len = typebuf_maplen();
+#ifdef FEAT_EVAL
+ int prev_VIsual_active = VIsual_active;
+#endif
+
// If an operation is pending, handle it. But not for K_IGNORE or
// K_MOUSEMOVE.
if (ca.cmdchar != K_IGNORE && ca.cmdchar != K_MOUSEMOVE)
@@ -984,7 +988,7 @@ normal_end:
msg_nowait = FALSE;
#ifdef FEAT_EVAL
- if (finish_op)
+ if (finish_op || prev_VIsual_active)
reset_reg_var();
#endif
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index f1a241313..4d04ff7cd 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -699,8 +699,13 @@ func Test_v_register()
let s:register = ''
call feedkeys('"_ddS', 'mx')
- call assert_equal('test@', getline('.')) " fails before 8.2.0929
call assert_equal('"', s:register) " fails before 8.2.0929
+ call assert_equal('test@', getline('.')) " fails before 8.2.0929
+
+ let s:register = ''
+ call feedkeys('V"_dS', 'mx')
+ call assert_equal('"', s:register)
+ call assert_equal('test@', getline('.'))
let s:register = ''
call feedkeys('"zS', 'mx')
@@ -719,6 +724,11 @@ func Test_v_register()
call assert_equal('"', s:register) " fails before 8.2.0929
call assert_equal('test@', getline('.')) " fails before 8.2.0929
+ let s:register = ''
+ normal V"_dS
+ call assert_equal('"', s:register)
+ call assert_equal('test@', getline('.'))
+
let s:register = ''
execute 'normal "z:call' "s:Put()
"
call assert_equal('z', s:register)
diff --git a/src/version.c b/src/version.c
index bf98e2d61..3217452c8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1858,
/**/
1857,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1v9Sjq-001F9X-3Q%40256bit.org.