Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
19456:c35caa98fe6a | 19457:b70fbf3f0e0b |
---|---|
2335 let lines = [ | 2335 let lines = [ |
2336 \ 'set t_u7=', | 2336 \ 'set t_u7=', |
2337 \ 'call setline(1, range(20))', | 2337 \ 'call setline(1, range(20))', |
2338 \ 'hi PopTerm ctermbg=grey', | 2338 \ 'hi PopTerm ctermbg=grey', |
2339 \ 'func OpenTerm(setColor)', | 2339 \ 'func OpenTerm(setColor)', |
2340 \ " let buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", | 2340 \ " let s:buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", |
2341 \ ' let s:winid = popup_create(buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', | 2341 \ ' let s:winid = popup_create(s:buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', |
2342 \ ' if a:setColor', | 2342 \ ' if a:setColor', |
2343 \ ' call win_execute(s:winid, "set wincolor=PopTerm")', | 2343 \ ' call win_execute(s:winid, "set wincolor=PopTerm")', |
2344 \ ' endif', | 2344 \ ' endif', |
2345 \ 'endfunc', | 2345 \ 'endfunc', |
2346 \ 'call OpenTerm(0)', | 2346 \ 'call OpenTerm(0)', |
2347 \ 'func HidePopup()', | 2347 \ 'func HidePopup()', |
2348 \ ' call popup_hide(s:winid)', | 2348 \ ' call popup_hide(s:winid)', |
2349 \ 'endfunc', | |
2350 \ 'func ClosePopup()', | |
2351 \ ' call popup_close(s:winid)', | |
2352 \ 'endfunc', | |
2353 \ 'func ReopenPopup()', | |
2354 \ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})', | |
2349 \ 'endfunc', | 2355 \ 'endfunc', |
2350 \ 'sleep 10m', | 2356 \ 'sleep 10m', |
2351 \ 'redraw', | 2357 \ 'redraw', |
2352 \ 'echo getwinvar(s:winid, "&buftype") win_gettype(s:winid)', | 2358 \ 'echo getwinvar(s:winid, "&buftype") win_gettype(s:winid)', |
2353 \ ] | 2359 \ ] |
2368 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>") | 2374 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>") |
2369 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {}) | 2375 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {}) |
2370 call term_sendkeys(buf, "\<CR>") | 2376 call term_sendkeys(buf, "\<CR>") |
2371 call term_wait(buf, 100) | 2377 call term_wait(buf, 100) |
2372 | 2378 |
2379 call term_sendkeys(buf, "\<C-W>:call ClosePopup()\<CR>") | |
2380 call VerifyScreenDump(buf, 'Test_terminal_popup_5', {}) | |
2381 | |
2382 call term_sendkeys(buf, "\<C-W>:call ReopenPopup()\<CR>") | |
2383 call VerifyScreenDump(buf, 'Test_terminal_popup_6', {}) | |
2384 call term_wait(buf, 100) | |
2385 | |
2373 call term_sendkeys(buf, ":q\<CR>") | 2386 call term_sendkeys(buf, ":q\<CR>") |
2374 call term_wait(buf, 100) " wait for terminal to vanish | 2387 call term_wait(buf, 100) " wait for terminal to vanish |
2375 | 2388 |
2376 call StopVimInTerminal(buf) | 2389 call StopVimInTerminal(buf) |
2377 call delete('XtermPopup') | 2390 call delete('XtermPopup') |