Mercurial > vim
diff src/testdir/test_popupwin.vim @ 29032:361b46a07f5e v8.2.5038
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Commit: https://github.com/vim/vim/commit/d28950f9540f77032cee0a3047b05bef50ea81dc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 29 14:13:04 2022 +0100
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Problem: A finished terminal in a popup window does not show a scrollbar.
Solution: Show the scrollbar if the terminal job is finished. (closes
#10497)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 29 May 2022 15:15:05 +0200 |
parents | a8c2bd5fc727 |
children | f3c014fe5c16 |
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -2856,7 +2856,7 @@ func Test_popupwin_terminal_buffer() call assert_fails('call popup_create(termbuf2, #{})', 'E861:') call term_sendkeys(termbuf2, "exit\<CR>") - " Exiting shell closes popup window + " Exiting shell puts popup window in Terminal-Normal mode. call feedkeys("exit\<CR>", 'xt') " Wait for shell to exit call WaitForAssert({-> assert_equal("dead", job_status(term_getjob(termbuf)))}) @@ -2866,6 +2866,42 @@ func Test_popupwin_terminal_buffer() call assert_equal(origwin, win_getid()) endfunc +func Test_popupwin_terminal_scrollbar() + CheckFeature terminal + CheckScreendump + CheckUnix + + call writefile(range(50), 'Xtestfile') + let lines =<< trim END + vim9script + + term_start(['cat', 'Xtestfile'], {hidden: true}) + ->popup_create({ + minwidth: 40, + maxwidth: 40, + minheight: 8, + maxheight: 8, + scrollbar: true, + border: [] + }) + END + call writefile(lines, 'Xpterm') + let buf = RunVimInTerminal('-S Xpterm', #{rows: 15}) + call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_1', {}) + + " scroll to the middle + call term_sendkeys(buf, "50%") + call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_2', {}) + + " close the popupwin. + call term_sendkeys(buf, ":q\<CR>") + call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_3', {}) + + call StopVimInTerminal(buf) + call delete('Xtestfile') + call delete('Xpterm') +endfunc + func Test_popupwin_close_prevwin() CheckFeature terminal call Popupwin_close_prevwin()