summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_normal.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-26 14:47:24 +0000
committerBram Moolenaar <Bram@vim.org>2023-02-26 14:47:24 +0000
commit4f026ea9f1ad9db262f0dba522768c84e5ae37b4 (patch)
treef2f9744ff7341c7dd0a7f69a032eb36956ab7273 /src/testdir/test_normal.vim
parent83ae6150bf6bd313487b3a51f9be9836e8b9c20f (diff)
patch 9.0.1356: cannot cancel "gr" with Escv9.0.1356
Problem: Cannot cancel "gr" with Esc. Solution: Make "gr<Esc>" do nothing. (closes #12064)
Diffstat (limited to 'src/testdir/test_normal.vim')
-rw-r--r--src/testdir/test_normal.vim23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 38234cd6c7..6db5af76ab 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -3273,9 +3273,9 @@ func Test_delete_until_paragraph()
endfunc
" Test for the gr (virtual replace) command
-" Test for the bug fixed by 7.4.387
func Test_gr_command()
enew!
+ " Test for the bug fixed by 7.4.387
let save_cpo = &cpo
call append(0, ['First line', 'Second line', 'Third line'])
exe "normal i\<C-G>u"
@@ -3288,10 +3288,12 @@ func Test_gr_command()
normal 4gro
call assert_equal('ooooecond line', getline(2))
let &cpo = save_cpo
+
normal! ggvegrx
call assert_equal('xxxxx line', getline(1))
exe "normal! gggr\<C-V>122"
call assert_equal('zxxxx line', getline(1))
+
set virtualedit=all
normal! 15|grl
call assert_equal('zxxxx line l', getline(1))
@@ -3299,8 +3301,25 @@ func Test_gr_command()
set nomodifiable
call assert_fails('normal! grx', 'E21:')
call assert_fails('normal! gRx', 'E21:')
+ call assert_nobeep("normal! gr\<Esc>")
set modifiable&
- enew!
+
+ call assert_nobeep("normal! gr\<Esc>")
+ call assert_beeps("normal! cgr\<Esc>")
+
+ call assert_equal('zxxxx line l', getline(1))
+ exe "normal! 2|gr\<C-V>\<Esc>"
+ call assert_equal("z\<Esc>xx line l", getline(1))
+
+ call setline(1, 'abcdef')
+ exe "normal! 0gr\<C-O>lx"
+ call assert_equal("\<C-O>def", getline(1))
+
+ call setline(1, 'abcdef')
+ exe "normal! 0gr\<C-G>lx"
+ call assert_equal("\<C-G>def", getline(1))
+
+ bwipe!
endfunc
func Test_nv_hat_count()