patch 8.2.3980: if 'operatorfunc' invokes an operator Visual mode is changed
Problem: If 'operatorfunc' invokes an operator the remembered Visual mode
may be changed. (Naohiro Ono)
Solution: Save and restore the information for redoing the Visual area.
(closes #9455)
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 1005694..90b7f9d 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -464,6 +464,10 @@
let g:opfunc_count = v:count
endfunc
+func Underscorize(_)
+ normal! '[V']r_
+endfunc
+
func Test_normal09c_operatorfunc()
" Test redoing operatorfunc
new
@@ -477,6 +481,16 @@
bw!
unlet g:opfunc_count
+
+ " Test redoing Visual mode
+ set operatorfunc=Underscorize
+ new
+ call setline(1, ['first', 'first', 'third', 'third', 'second'])
+ normal! 1GVjr_
+ normal! 5G.
+ normal! 3G.
+ call assert_equal(['_____', '_____', '_____', '_____', '______'], getline(1, '$'))
+ bwipe!
set operatorfunc=
endfunc