From abf42b7ec6b408d4b4ce8c66b6a8a77c638d3c75 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 14 Feb 2022 13:08:00 +0000 Subject: [PATCH] test(old): cherry-pick test_visual changes from v8.2.0369 https://github.com/vim/vim/commit/1671f4488105ee12a6a8558ae351436c26ab55fc Omit Test_AAA_start_visual_mode_with_count comment change as it hasn't been ported yet. --- src/nvim/testdir/test_visual.vim | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 099a90643f..2fc7fd0e9c 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -132,11 +132,16 @@ func Test_blockwise_visual_o_O() exe "norm! gvO\rb" exe "norm! gvo\rc" exe "norm! gvO\rd" + set selection=exclusive + exe "norm! gvOo\re" + call assert_equal('...a be.', getline(4)) + exe "norm! gvOO\rf" + set selection& call assert_equal(['..........', \ '...c d..', \ '... ..', - \ '...a b..', + \ '...a bf.', \ '..........'], getline(1, '$')) enew! @@ -658,6 +663,16 @@ func Test_characterwise_select_mode() exe "normal Gkgh\\\" call assert_equal(['', 'a', ''], getline(1, '$')) + " CTRL-H in select mode behaves like 'x' + call setline(1, 'abcdef') + exe "normal! gggh\\\\" + call assert_equal('ef', getline(1)) + + " CTRL-O in select mode switches to visual mode for one command + call setline(1, 'abcdef') + exe "normal! gggh\3lm" + call assert_equal('mef', getline(1)) + sunmap End> sunmap Down> sunmap Del> @@ -757,8 +772,7 @@ endfunc func Test_visual_block_mode() new call append(0, '') - call setline(1, ['abcdefghijklm', 'abcdefghijklm', 'abcdefghijklm', - \ 'abcdefghijklm', 'abcdefghijklm']) + call setline(1, repeat(['abcdefghijklm'], 5)) call cursor(1, 1) " Test shift-right of a block @@ -777,6 +791,16 @@ func Test_visual_block_mode() \ 'axyzqqqqefgmnoklm', \ 'abcdqqqqijklm'], getline(1, 5)) + " Test 'C' to change till the end of the line + call cursor(3, 4) + exe "normal! \j3lCooo" + call assert_equal(['axyooo', 'axyooo'], getline(3, 4)) + + " Test 'D' to delete till the end of the line + call cursor(3, 3) + exe "normal! \j2lD" + call assert_equal(['ax', 'ax'], getline(3, 4)) + " Test from ':help v_b_I_example' %d _ setlocal tabstop=8 shiftwidth=4