comparison src/testdir/test_normal.vim @ 32108:cbf0ed5c83d0 v9.0.1385

patch 9.0.1385: g'Esc is considered an error Commit: https://github.com/vim/vim/commit/f86dea8119f3141e3d2c680219036d1511101f9b Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Mar 5 21:15:06 2023 +0000 patch 9.0.1385: g'Esc is considered an error Problem: g'Esc is considered an error. Solution: Make g'Esc silently abandon the command. (closes https://github.com/vim/vim/issues/12110)
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Mar 2023 22:30:03 +0100
parents 717a1a8dc751
children 66961c678d8a
comparison
equal deleted inserted replaced
32107:e34ae0c7da99 32108:cbf0ed5c83d0
2524 call assert_equal('1', getline('.')) 2524 call assert_equal('1', getline('.'))
2525 call cursor(10, 1) 2525 call cursor(10, 1)
2526 norm! g'a 2526 norm! g'a
2527 call assert_equal('>', a[-1:]) 2527 call assert_equal('>', a[-1:])
2528 call assert_equal(1, line('.')) 2528 call assert_equal(1, line('.'))
2529 call assert_nobeep("normal! g`\<Esc>")
2530 call assert_nobeep("normal! g'\<Esc>")
2529 2531
2530 " Test for g; and g, 2532 " Test for g; and g,
2531 norm! g; 2533 norm! g;
2532 " there is only one change in the changelist 2534 " there is only one change in the changelist
2533 " currently, when we setup the window 2535 " currently, when we setup the window
3303 call assert_fails('normal! gRx', 'E21:') 3305 call assert_fails('normal! gRx', 'E21:')
3304 call assert_nobeep("normal! gr\<Esc>") 3306 call assert_nobeep("normal! gr\<Esc>")
3305 set modifiable& 3307 set modifiable&
3306 3308
3307 call assert_nobeep("normal! gr\<Esc>") 3309 call assert_nobeep("normal! gr\<Esc>")
3308 call assert_beeps("normal! cgr\<Esc>") 3310 call assert_nobeep("normal! cgr\<Esc>")
3311 call assert_beeps("normal! cgrx")
3309 3312
3310 call assert_equal('zxxxx line l', getline(1)) 3313 call assert_equal('zxxxx line l', getline(1))
3311 exe "normal! 2|gr\<C-V>\<Esc>" 3314 exe "normal! 2|gr\<C-V>\<Esc>"
3312 call assert_equal("z\<Esc>xx line l", getline(1)) 3315 call assert_equal("z\<Esc>xx line l", getline(1))
3313 3316
3919 call assert_equal(['busy', 'arrow'], readfile('Xmouseshapes')) 3922 call assert_equal(['busy', 'arrow'], readfile('Xmouseshapes'))
3920 3923
3921 call delete('Xmouseshapes') 3924 call delete('Xmouseshapes')
3922 endfunc 3925 endfunc
3923 3926
3927 " Test that mouse shape is restored to Normal mode after cancelling "gr".
3928 func Test_mouse_shape_after_cancelling_gr()
3929 CheckFeature mouseshape
3930 CheckCanRunGui
3931
3932 let lines =<< trim END
3933 vim9script
3934 var mouse_shapes = []
3935
3936 feedkeys('gr')
3937 timer_start(50, (_) => {
3938 mouse_shapes += [getmouseshape()]
3939 timer_start(50, (_) => {
3940 feedkeys("\<Esc>")
3941 timer_start(50, (_) => {
3942 mouse_shapes += [getmouseshape()]
3943 timer_start(50, (_) => {
3944 writefile(mouse_shapes, 'Xmouseshapes')
3945 quit
3946 })
3947 })
3948 })
3949 })
3950 END
3951 call writefile(lines, 'Xmouseshape.vim', 'D')
3952 call RunVim([], [], "-g -S Xmouseshape.vim")
3953 sleep 300m
3954 call assert_equal(['beam', 'arrow'], readfile('Xmouseshapes'))
3955
3956 call delete('Xmouseshapes')
3957 endfunc
3958
3924 " vim: shiftwidth=2 sts=2 expandtab 3959 " vim: shiftwidth=2 sts=2 expandtab