aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-07 06:43:08 +0800
committerGitHub <noreply@github.com>2024-03-07 06:43:08 +0800
commit6525832a8c4d44a8ebabba02a5ea1ce09b389a4f (patch)
tree9edf1b25fcf5b2e953319916f8b605c3af106b53 /test/old/testdir
parentae5095cac9b233cfb6785534de6f084c70dc6424 (diff)
downloadrneovim-6525832a8c4d44a8ebabba02a5ea1ce09b389a4f.tar.gz
rneovim-6525832a8c4d44a8ebabba02a5ea1ce09b389a4f.tar.bz2
rneovim-6525832a8c4d44a8ebabba02a5ea1ce09b389a4f.zip
vim-patch:9.1.0155: can only get getregion() from current buffer (#27757)
Problem: can only call getregion() for current buffer Solution: Allow to retrieve selections from different buffers (Shougo Matsushita) closes: vim/vim#14131 https://github.com/vim/vim/commit/84bf6e658da51126bdd2e50af1f40cabd149343f Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Diffstat (limited to 'test/old/testdir')
-rw-r--r--test/old/testdir/test_visual.vim30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim
index 8473f5b7bb..4c5ab9f61f 100644
--- a/test/old/testdir/test_visual.vim
+++ b/test/old/testdir/test_visual.vim
@@ -1751,7 +1751,7 @@ func Test_visual_getregion()
#" using the wrong type
call assert_fails(':echo "."->getpos()->getregion("$", [])', 'E1211:')
- #" using a mark in another buffer
+ #" using a mark from another buffer to current buffer
new
VAR newbuf = bufnr()
call setline(1, range(10))
@@ -1761,6 +1761,20 @@ func Test_visual_getregion()
call assert_equal([], getregion(getpos('.'), getpos("'A"), {'type': 'v' }))
call assert_equal([], getregion(getpos("'A"), getpos('.'), {'type': 'v' }))
exe $':{newbuf}bwipe!'
+
+ #" using a mark from another buffer to another buffer
+ new
+ VAR anotherbuf = bufnr()
+ call setline(1, range(10))
+ normal! GmA
+ normal! GmB
+ wincmd p
+ call assert_equal([anotherbuf, 10, 1, 0], getpos("'A"))
+ call assert_equal(['9'], getregion(getpos("'B"), getpos("'A"), {'type': 'v' }))
+ exe $':{anotherbuf}bwipe!'
+
+ #" using invalid buffer
+ call assert_equal([], getregion([10000, 10, 1, 0], [10000, 10, 1, 0]))
END
call CheckLegacyAndVim9Success(lines)
@@ -1911,4 +1925,18 @@ func Test_visual_getregion()
call CheckLegacyAndVim9Success(lines)
endfunc
+func Test_getregion_invalid_buf()
+ new
+ help
+ call cursor(5, 7)
+ norm! mA
+ call cursor(5, 18)
+ norm! mB
+ call assert_equal(['Move around:'], getregion(getpos("'A"), getpos("'B")))
+ " close the help window
+ q
+ call assert_equal([], getregion(getpos("'A"), getpos("'B")))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab