patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Problem: Popupwindow lacks scrollbar if no "maxheight" is used.
Solution: Compute the max height depending on the position. (closes #6664)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 30dfc66..c44c847 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2144,6 +2144,36 @@
call delete('XtestPopupScroll')
endfunc
+func Test_popup_too_high_scrollbar()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, range(1, 20)->map({i, v -> repeat(v, 10)}))
+ set scrolloff=0
+ func ShowPopup()
+ let winid = popup_atcursor(['one', 'two', 'three', 'four', 'five',
+ \ 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'], #{
+ \ minwidth: 8,
+ \ border: [],
+ \ })
+ endfunc
+ normal 3G$
+ call ShowPopup()
+ END
+ call writefile(lines, 'XtestPopupToohigh')
+ let buf = RunVimInTerminal('-S XtestPopupToohigh', #{rows: 10})
+ call VerifyScreenDump(buf, 'Test_popupwin_toohigh_1', {})
+
+ call term_sendkeys(buf, ":call popup_clear()\<CR>")
+ call term_sendkeys(buf, "8G$")
+ call term_sendkeys(buf, ":call ShowPopup()\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_toohigh_2', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupToohigh')
+endfunc
+
func Test_popup_fitting_scrollbar()
" this was causing a crash, divide by zero
let winid = popup_create([