summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_registers.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-12 00:09:31 +0200
committerChristian Brabandt <cb@256bit.org>2023-08-12 00:09:31 +0200
commitbacc83009bc38c9ba0247aaa22b76d1993d57993 (patch)
treecb8534344967454cd4be03c7c78943103ff02be3 /src/testdir/test_registers.vim
parent2d63e4b3ccc0bb34db21a3c1d024cb114f8c4071 (diff)
patch 9.0.1694: wrong mapping applied when replaying a char searchv9.0.1694
Problem: wrong mapping applied when replaying a char search Solution: Store a NOP after the ESC closes: #12708 closes: #6350 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/testdir/test_registers.vim')
-rw-r--r--src/testdir/test_registers.vim26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index 46142d681b..e8bee99d74 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -797,8 +797,9 @@ func Test_record_in_select_mode()
bwipe!
endfunc
-" mapping that ends macro recording should be removed from recorded macro
+" A mapping that ends recording should be removed from the recorded register.
func Test_end_record_using_mapping()
+ new
call setline(1, 'aaa')
nnoremap s q
call feedkeys('safas', 'tx')
@@ -818,7 +819,10 @@ func Test_end_record_using_mapping()
bwipe!
endfunc
+" Starting a new recording should work immediately after replaying a recording
+" that ends with a <Nop> mapping or a character search.
func Test_end_reg_executing()
+ new
nnoremap s <Nop>
let @a = 's'
call feedkeys("@aqaq\<Esc>", 'tx')
@@ -836,6 +840,26 @@ func Test_end_reg_executing()
bwipe!
endfunc
+" An operator-pending mode mapping shouldn't be applied to keys typed in
+" Insert mode immediately after a character search when replaying.
+func Test_replay_charsearch_omap()
+ CheckFeature timers
+
+ new
+ call setline(1, 'foo[blah]')
+ onoremap , k
+ call timer_start(10, {-> feedkeys(",bar\<Esc>q", 't')})
+ call feedkeys('qrct[', 'xt!')
+ call assert_equal(',bar[blah]', getline(1))
+ undo
+ call assert_equal('foo[blah]', getline(1))
+ call feedkeys('@r', 'xt!')
+ call assert_equal(',bar[blah]', getline(1))
+
+ ounmap ,
+ bwipe!
+endfunc
+
" This was causing a crash because y_append was ending up being NULL
func Test_zero_y_append()
" Run in a separate Vim instance because changing 'encoding' may cause