Mercurial > vim
diff src/testdir/test_popupwin.vim @ 21713:b997e872ff95 v8.2.1406
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Commit: https://github.com/vim/vim/commit/a1b9b0cc011ef15869ac25cb93e1b4baa0cb7f38
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 9 16:37:48 2020 +0200
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 https://github.com/vim/vim/issues/6664)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Aug 2020 16:45:04 +0200 |
parents | cbc570e66d11 |
children | f2ba8ebbab2b |
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -2144,6 +2144,36 @@ func Test_popup_scrollbar() 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([