From e389b189021cb6b72cfd7583ce6fb5d8d3346d45 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 6 Mar 2023 07:52:11 +0800 Subject: vim-patch:9.0.1385: g'Esc is considered an error (#22544) Problem: g'Esc is considered an error. Solution: Make g'Esc silently abandon the command. (closes vim/vim#12110) https://github.com/vim/vim/commit/f86dea8119f3141e3d2c680219036d1511101f9b --- src/nvim/testdir/test_normal.vim | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index 5d8e1913a2..582596748f 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -2540,6 +2540,8 @@ func Test_normal33_g_cmd2() norm! g'a call assert_equal('>', a[-1:]) call assert_equal(1, line('.')) + call assert_nobeep("normal! g`\") + call assert_nobeep("normal! g'\") " Test for g; and g, norm! g; @@ -3315,7 +3317,8 @@ func Test_gr_command() set modifiable& call assert_nobeep("normal! gr\") - call assert_beeps("normal! cgr\") + call assert_nobeep("normal! cgr\") + call assert_beeps("normal! cgrx") call assert_equal('zxxxx line l', getline(1)) exe "normal! 2|gr\\" @@ -3895,4 +3898,36 @@ func Test_mouse_shape_after_failed_change() call delete('Xmouseshapes') endfunc +" Test that mouse shape is restored to Normal mode after cancelling "gr". +func Test_mouse_shape_after_cancelling_gr() + CheckFeature mouseshape + CheckCanRunGui + + let lines =<< trim END + vim9script + var mouse_shapes = [] + + feedkeys('gr') + timer_start(50, (_) => { + mouse_shapes += [getmouseshape()] + timer_start(50, (_) => { + feedkeys("\") + timer_start(50, (_) => { + mouse_shapes += [getmouseshape()] + timer_start(50, (_) => { + writefile(mouse_shapes, 'Xmouseshapes') + quit + }) + }) + }) + }) + END + call writefile(lines, 'Xmouseshape.vim', 'D') + call RunVim([], [], "-g -S Xmouseshape.vim") + sleep 300m + call assert_equal(['beam', 'arrow'], readfile('Xmouseshapes')) + + call delete('Xmouseshapes') +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit