Mercurial > vim
comparison src/testdir/test_terminal.vim @ 19265:ce8c47ed54e5 v8.2.0191
patch 8.2.0191: cannot put a terminal in a popup window
Commit: https://github.com/vim/vim/commit/219c7d063823498be22aae46dd024d77b5fb2a58
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 1 21:57:29 2020 +0100
patch 8.2.0191: cannot put a terminal in a popup window
Problem: Cannot put a terminal in a popup window.
Solution: Allow opening a terminal in a popup window. It will always have
keyboard focus until closed.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Feb 2020 22:00:04 +0100 |
parents | 5ed8297121fa |
children | ebeeb4b4a1fa |
comparison
equal
deleted
inserted
replaced
19264:489e4c8101ba | 19265:ce8c47ed54e5 |
---|---|
2319 call ch_logfile('') | 2319 call ch_logfile('') |
2320 call delete('Xlog') | 2320 call delete('Xlog') |
2321 unlet! g:called_bufnum | 2321 unlet! g:called_bufnum |
2322 unlet! g:called_arg | 2322 unlet! g:called_arg |
2323 endfunc | 2323 endfunc |
2324 | |
2325 func Test_terminal_in_popup() | |
2326 CheckRunVimInTerminal | |
2327 | |
2328 let text =<< trim END | |
2329 some text | |
2330 to edit | |
2331 in a popup window | |
2332 END | |
2333 call writefile(text, 'Xtext') | |
2334 let cmd = GetVimCommandClean() | |
2335 let lines = [ | |
2336 \ 'call setline(1, range(20))', | |
2337 \ 'hi PopTerm ctermbg=grey', | |
2338 \ 'func OpenTerm(setColor)', | |
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})', | |
2341 \ ' if a:setColor', | |
2342 \ ' call win_execute(winid, "set wincolor=PopTerm")', | |
2343 \ ' endif', | |
2344 \ 'endfunc', | |
2345 \ 'call OpenTerm(0)', | |
2346 \ ] | |
2347 call writefile(lines, 'XtermPopup') | |
2348 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) | |
2349 call VerifyScreenDump(buf, 'Test_terminal_popup_1', {}) | |
2350 | |
2351 call term_sendkeys(buf, ":q\<CR>") | |
2352 call VerifyScreenDump(buf, 'Test_terminal_popup_2', {}) | |
2353 | |
2354 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") | |
2355 call term_sendkeys(buf, ":set hlsearch\<CR>") | |
2356 call term_sendkeys(buf, "/edit\<CR>") | |
2357 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) | |
2358 | |
2359 call term_sendkeys(buf, ":q\<CR>") | |
2360 call term_wait(buf, 50) " wait for terminal to vanish | |
2361 | |
2362 call StopVimInTerminal(buf) | |
2363 call delete('XtermPopup') | |
2364 endfunc |