diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2025-02-05 23:09:29 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2025-02-05 23:09:29 +0000 |
commit | d5f194ce780c95821a855aca3c19426576d28ae0 (patch) | |
tree | d45f461b19f9118ad2bb1f440a7a08973ad18832 /test/old/testdir/test_visual.vim | |
parent | c5d770d311841ea5230426cc4c868e8db27300a8 (diff) | |
parent | 44740e561fc93afe3ebecfd3618bda2d2abeafb0 (diff) | |
download | rneovim-rahm.tar.gz rneovim-rahm.tar.bz2 rneovim-rahm.zip |
Diffstat (limited to 'test/old/testdir/test_visual.vim')
-rw-r--r-- | test/old/testdir/test_visual.vim | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index e25327ddd4..328ac502bf 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -470,7 +470,7 @@ func Test_Visual_Block() \ "\t{", \ "\t}"], getline(1, '$')) - close! + bw! endfunc " Test for 'p'ut in visual block mode @@ -1082,7 +1082,7 @@ func Test_star_register() delmarks < > call assert_fails('*yank', 'E20:') - close! + bw! endfunc " Test for changing text in visual mode with 'exclusive' selection @@ -1098,7 +1098,7 @@ func Test_exclusive_selection() call assert_equal('l one', getline(1)) set virtualedit& set selection& - close! + bw! endfunc " Test for starting linewise visual with a count. @@ -1155,7 +1155,7 @@ func Test_visual_inner_block() 8,9d call cursor(5, 1) call assert_beeps('normal ViBiB') - close! + bw! endfunc func Test_visual_put_in_block() @@ -2718,4 +2718,68 @@ func Test_visual_block_cursor_insert_enter() bwipe! endfunc +func Test_visual_block_exclusive_selection() + new + set selection=exclusive + call setline(1, ['asöd asdf', 'asdf asdf', 'as€d asdf', 'asdf asdf']) + call cursor(1, 1) + exe ":norm! \<c-v>eh3j~" + call assert_equal(['ASÖd asdf', 'ASDf asdf', 'AS€d asdf', 'ASDf asdf'], getline(1, '$')) + exe ":norm! 1v~" + call assert_equal(['asöd asdf', 'asdf asdf', 'as€d asdf', 'asdf asdf'], getline(1, '$')) + bwipe! + set selection&vim +endfunc + +func Test_visual_block_exclusive_selection_adjusted() + new + " Test that the end-position of the visual selection is adjusted for exclusive selection + set selection=exclusive + call setline(1, ['asöd asdf ', 'asdf asdf ', 'as€d asdf ', 'asdf asdf ']) + call cursor(1, 1) + " inclusive motion + exe ":norm! \<c-v>e3jy" + call assert_equal([0, 4, 5, 0], getpos("'>")) + " exclusive motion + exe ":norm! \<c-v>ta3jy" + call assert_equal([0, 4, 6, 0], getpos("'>")) + " another inclusive motion + exe ":norm! \<c-v>g_3jy" + call assert_equal([0, 4, 10, 0], getpos("'>")) + + " Reset selection option to Vim default + set selection&vim + call cursor(1, 1) + + " inclusive motion + exe ":norm! \<c-v>e3jy" + call assert_equal([0, 4, 4, 0], getpos("'>")) + " exclusive motion + exe ":norm! \<c-v>ta3jy" + call assert_equal([0, 4, 5, 0], getpos("'>")) + " another inclusive motion + exe ":norm! \<c-v>g_3jy" + call assert_equal([0, 4, 9, 0], getpos("'>")) + bwipe! + set selection&vim +endfunc + +" the following caused a Heap-Overflow, because Vim was accessing outside of a +" line end +func Test_visual_pos_buffer_heap_overflow() + set virtualedit=all + args Xa Xb + all + call setline(1, ['', '', '']) + call cursor(3, 1) + wincmd w + call setline(1, 'foobar') + normal! $lv0 + all + call setreg('"', 'baz') + normal! [P + set virtualedit= + bw! Xa Xb +endfunc + " vim: shiftwidth=2 sts=2 expandtab |