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 #7000) Add the "winid" argument to
getcurpos().
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 7ff9b7a..2492c93 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2520,7 +2520,19 @@
call assert_equal('6', @")
call assert_equal(-1, setpos('.', test_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
" Test for glob()
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 954086c..333e9a2 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -516,6 +516,19 @@
call popup_close(winid)
endfunc
+func Test_popup_firstline_cursorline()
+ let winid = popup_create(['1111', '222222', '33333', '44444'], #{
+ \ maxheight: 2,
+ \ firstline: 3,
+ \ cursorline: 1,
+ \ })
+ call assert_equal(3, popup_getoptions(winid).firstline)
+ call assert_equal(3, getwininfo(winid)[0].topline)
+ call assert_equal(3, getcurpos(winid)[1])
+
+ call popup_close(winid)
+endfunc
+
func Test_popup_noscrolloff()
set scrolloff=5
let winid = popup_create(['xxx']->repeat(50), #{