patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Problem: Wrong default when "pos" is changed with popup_atcursor().
Solution: Adjust the default line and col when "pos" is not the default
value. (#5151)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index eab569f..52d5add 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1294,6 +1294,42 @@
bwipe!
endfunc
+func Test_popup_atcursor_pos()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, repeat([repeat('-', 60)], 15))
+ set so=0
+
+ normal 9G3|r#
+ let winid1 = popup_atcursor(['first', 'second'], #{
+ \ moved: [0, 0, 0],
+ \ })
+ normal 9G21|r&
+ let winid1 = popup_atcursor(['FIrsT', 'SEcoND'], #{
+ \ pos: 'botright',
+ \ moved: [0, 0, 0],
+ \ })
+ normal 3G27|r%
+ let winid1 = popup_atcursor(['fiRSt', 'seCOnd'], #{
+ \ pos: 'topleft',
+ \ moved: [0, 0, 0],
+ \ })
+ normal 3G45|r@
+ let winid1 = popup_atcursor(['First', 'SeconD'], #{
+ \ pos: 'topright',
+ \ moved: [0, 0, 0],
+ \ })
+ END
+ call writefile(lines, 'XtestPopupAtcursorPos')
+ let buf = RunVimInTerminal('-S XtestPopupAtcursorPos', #{rows: 12})
+ call VerifyScreenDump(buf, 'Test_popupwin_atcursor_pos', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupAtcursorPos')
+endfunc
+
func Test_popup_beval()
CheckScreendump
CheckFeature balloon_eval_term