aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-12-17 09:03:26 +0800
committerGitHub <noreply@github.com>2024-12-17 09:03:26 +0800
commit15153c4cd5319652bcdcd608fe5d4f0fa1eb9419 (patch)
treea1c7d651870d90a102fe006d203f0060eb8711fa /test
parent137308a3c9b658c7dc9268201dfaea4d601b79c7 (diff)
downloadrneovim-15153c4cd5319652bcdcd608fe5d4f0fa1eb9419.tar.gz
rneovim-15153c4cd5319652bcdcd608fe5d4f0fa1eb9419.tar.bz2
rneovim-15153c4cd5319652bcdcd608fe5d4f0fa1eb9419.zip
vim-patch:9.1.0938: exclusive selection not respected when re-selecting block mode (#31603)
Problem: exclusive selection not respected when re-selecting block mode (Matt Ellis) Solution: advance selection by another character when using selection=exclusive and visual block mode fixes: vim/vim#16202 closes: vim/vim#16219 https://github.com/vim/vim/commit/bb955894734b287abfadd3a25786a42038d18d61 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_visual.vim46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim
index e25327ddd4..39388cbc27 100644
--- a/test/old/testdir/test_visual.vim
+++ b/test/old/testdir/test_visual.vim
@@ -2718,4 +2718,50 @@ 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
+
" vim: shiftwidth=2 sts=2 expandtab