aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-06 04:46:16 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-02-06 04:46:16 +0800
commit8ba9f19961d8573dc851d3d5f2ec217ad2fb7b28 (patch)
treedcade506fff3749f5561d947067e730ca66cf126 /src/nvim/testdir
parent92e92f02e7106fcad1597bb8f0edf1e43186a07f (diff)
downloadrneovim-8ba9f19961d8573dc851d3d5f2ec217ad2fb7b28.tar.gz
rneovim-8ba9f19961d8573dc851d3d5f2ec217ad2fb7b28.tar.bz2
rneovim-8ba9f19961d8573dc851d3d5f2ec217ad2fb7b28.zip
vim-patch:8.2.1727: a popup created with "cursorline" will ignore "firstline"
Problem: A popup created with "cursorline" will ignore "firstline". Solution: When both "cursorline" and "firstline" are present put the cursor on "firstline". (closes vim/vim#7000) Add the "winid" argument to getcurpos(). https://github.com/vim/vim/commit/99ca9c4868bb1669706b9e3de9a9218bd11cc459 Skip popup window related code. Cherry-pick all of Test_getcurpos_setpos() from patch 8.2.0610.
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_functions.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 42facdd491..6c2b0b97b6 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -1712,6 +1712,33 @@ func Test_nr2char()
call assert_equal("\x80\xfc\b\xfd\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX", eval('"\<M-' .. nr2char(0x40000000) .. '>"'))
endfunc
+" Test for getcurpos() and setpos()
+func Test_getcurpos_setpos()
+ new
+ call setline(1, ['012345678', '012345678'])
+ normal gg6l
+ let sp = getcurpos()
+ normal 0
+ call setpos('.', sp)
+ normal jyl
+ call assert_equal('6', @")
+ call assert_equal(-1, setpos('.', v:_null_list))
+ call assert_equal(-1, setpos('.', {}))
+
+ let winid = win_getid()
+ normal G$
+ let pos = getcurpos()
+ wincmd w
+ call assert_equal(pos, getcurpos(winid))
+
+ wincmd w
+ close!
+
+ call assert_equal(getcurpos(), getcurpos(0))
+ call assert_equal([0, 0, 0, 0, 0], getcurpos(-1))
+ call assert_equal([0, 0, 0, 0, 0], getcurpos(1999))
+endfunc
+
func HasDefault(msg = 'msg')
return a:msg
endfunc