Mercurial > vim
comparison src/testdir/test_terminal.vim @ 19312:18fc30542bf5 v8.2.0214
patch 8.2.0214: a popup window with a terminal can be made hidden
Commit: https://github.com/vim/vim/commit/2e6638d5f03ae183999c726ba63e528d556342c0
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 5 21:07:18 2020 +0100
patch 8.2.0214: a popup window with a terminal can be made hidden
Problem: A popup window with a terminal can be made hidden.
Solution: Disallow hiding a terminal popup.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 05 Feb 2020 21:15:04 +0100 |
parents | a4b65930a0dc |
children | 673a95ef80af |
comparison
equal
deleted
inserted
replaced
19311:8dec49d5737c | 19312:18fc30542bf5 |
---|---|
2335 let lines = [ | 2335 let lines = [ |
2336 \ 'call setline(1, range(20))', | 2336 \ 'call setline(1, range(20))', |
2337 \ 'hi PopTerm ctermbg=grey', | 2337 \ 'hi PopTerm ctermbg=grey', |
2338 \ 'func OpenTerm(setColor)', | 2338 \ 'func OpenTerm(setColor)', |
2339 \ " let buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", | 2339 \ " let buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", |
2340 \ ' let winid = popup_create(buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', | 2340 \ ' let s:winid = popup_create(buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', |
2341 \ ' if a:setColor', | 2341 \ ' if a:setColor', |
2342 \ ' call win_execute(winid, "set wincolor=PopTerm")', | 2342 \ ' call win_execute(s:winid, "set wincolor=PopTerm")', |
2343 \ ' endif', | 2343 \ ' endif', |
2344 \ 'endfunc', | 2344 \ 'endfunc', |
2345 \ 'call OpenTerm(0)', | 2345 \ 'call OpenTerm(0)', |
2346 \ 'func HidePopup()', | |
2347 \ ' call popup_hide(s:winid)', | |
2348 \ 'endfunc', | |
2346 \ ] | 2349 \ ] |
2347 call writefile(lines, 'XtermPopup') | 2350 call writefile(lines, 'XtermPopup') |
2348 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) | 2351 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
2349 call VerifyScreenDump(buf, 'Test_terminal_popup_1', {}) | 2352 call VerifyScreenDump(buf, 'Test_terminal_popup_1', {}) |
2350 | 2353 |
2354 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") | 2357 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") |
2355 call term_sendkeys(buf, ":set hlsearch\<CR>") | 2358 call term_sendkeys(buf, ":set hlsearch\<CR>") |
2356 call term_sendkeys(buf, "/edit\<CR>") | 2359 call term_sendkeys(buf, "/edit\<CR>") |
2357 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) | 2360 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) |
2358 | 2361 |
2362 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>") | |
2363 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {}) | |
2364 call term_sendkeys(buf, "\<CR>") | |
2365 | |
2359 call term_sendkeys(buf, ":q\<CR>") | 2366 call term_sendkeys(buf, ":q\<CR>") |
2360 call term_wait(buf, 100) " wait for terminal to vanish | 2367 call term_wait(buf, 100) " wait for terminal to vanish |
2361 | 2368 |
2362 call StopVimInTerminal(buf) | 2369 call StopVimInTerminal(buf) |
2363 call delete('XtermPopup') | 2370 call delete('XtermPopup') |