Mercurial > vim
diff src/testdir/test_terminal.vim @ 19457:b70fbf3f0e0b v8.2.0286
patch 8.2.0286: cannot use popup_close() for a terminal popup
Commit: https://github.com/vim/vim/commit/11ec807639ae642bf55da883918489e2cd9911ab
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Feb 20 20:12:29 2020 +0100
patch 8.2.0286: cannot use popup_close() for a terminal popup
Problem: Cannot use popup_close() for a terminal popup.
Solution: Allow using popup_close(). (closes https://github.com/vim/vim/issues/5666)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 20 Feb 2020 20:15:04 +0100 |
parents | 21eefaf6bc5b |
children | 74add0046945 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -2337,8 +2337,8 @@ func Test_terminal_in_popup() \ 'call setline(1, range(20))', \ 'hi PopTerm ctermbg=grey', \ 'func OpenTerm(setColor)', - \ " let buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", - \ ' let s:winid = popup_create(buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', + \ " let s:buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", + \ ' let s:winid = popup_create(s:buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', \ ' if a:setColor', \ ' call win_execute(s:winid, "set wincolor=PopTerm")', \ ' endif', @@ -2347,6 +2347,12 @@ func Test_terminal_in_popup() \ 'func HidePopup()', \ ' call popup_hide(s:winid)', \ 'endfunc', + \ 'func ClosePopup()', + \ ' call popup_close(s:winid)', + \ 'endfunc', + \ 'func ReopenPopup()', + \ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})', + \ 'endfunc', \ 'sleep 10m', \ 'redraw', \ 'echo getwinvar(s:winid, "&buftype") win_gettype(s:winid)', @@ -2370,6 +2376,13 @@ func Test_terminal_in_popup() call term_sendkeys(buf, "\<CR>") call term_wait(buf, 100) + call term_sendkeys(buf, "\<C-W>:call ClosePopup()\<CR>") + call VerifyScreenDump(buf, 'Test_terminal_popup_5', {}) + + call term_sendkeys(buf, "\<C-W>:call ReopenPopup()\<CR>") + call VerifyScreenDump(buf, 'Test_terminal_popup_6', {}) + call term_wait(buf, 100) + call term_sendkeys(buf, ":q\<CR>") call term_wait(buf, 100) " wait for terminal to vanish