Mercurial > vim
comparison src/testdir/test_terminal.vim @ 19797:d73d982499ae v8.2.0455
patch 8.2.0455: cannot set the highlight group for a specific terminal
Commit: https://github.com/vim/vim/commit/83d4790a04780328c9c7ad22d18f404a27c11601
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 26 20:34:00 2020 +0100
patch 8.2.0455: cannot set the highlight group for a specific terminal
Problem: Cannot set the highlight group for a specific terminal.
Solution: Add the "highlight" option to term_start(). (closes https://github.com/vim/vim/issues/5818)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 26 Mar 2020 20:45:03 +0100 |
parents | cadb4c1bee6e |
children | 9981509b665f |
comparison
equal
deleted
inserted
replaced
19796:dd865be96964 | 19797:d73d982499ae |
---|---|
2432 END | 2432 END |
2433 call writefile(text, 'Xtext') | 2433 call writefile(text, 'Xtext') |
2434 let lines = [ | 2434 let lines = [ |
2435 \ 'set t_u7=', | 2435 \ 'set t_u7=', |
2436 \ 'call setline(1, range(20))', | 2436 \ 'call setline(1, range(20))', |
2437 \ 'hi PopTerm ctermbg=grey', | |
2438 \ 'func OpenTerm()', | 2437 \ 'func OpenTerm()', |
2439 \ " let s:buf = term_start('cat Xtext', #{hidden: 1})", | 2438 \ " let s:buf = term_start('cat Xtext', #{hidden: 1})", |
2440 \ ' let g:winid = popup_create(s:buf, #{ border: []})', | 2439 \ ' let g:winid = popup_create(s:buf, #{ border: []})', |
2441 \ 'endfunc', | 2440 \ 'endfunc', |
2442 \ ] | 2441 \ ] |
2453 call term_sendkeys(buf, ":q\<CR>") | 2452 call term_sendkeys(buf, ":q\<CR>") |
2454 call term_wait(buf, 100) " wait for terminal to vanish | 2453 call term_wait(buf, 100) " wait for terminal to vanish |
2455 call StopVimInTerminal(buf) | 2454 call StopVimInTerminal(buf) |
2456 call delete('Xtext') | 2455 call delete('Xtext') |
2457 call delete('XtermPopup') | 2456 call delete('XtermPopup') |
2457 endfunc | |
2458 | |
2459 " Check a terminal in popup window with different colors | |
2460 func Terminal_in_popup_colored(group_name, highlight_cmd, highlight_opt) | |
2461 CheckRunVimInTerminal | |
2462 CheckUnix | |
2463 | |
2464 let lines = [ | |
2465 \ 'set t_u7=', | |
2466 \ 'call setline(1, range(20))', | |
2467 \ 'func OpenTerm()', | |
2468 \ " let s:buf = term_start('cat', #{hidden: 1, " | |
2469 \ .. a:highlight_opt .. "})", | |
2470 \ ' let g:winid = popup_create(s:buf, #{ border: []})', | |
2471 \ 'endfunc', | |
2472 \ a:highlight_cmd, | |
2473 \ ] | |
2474 call writefile(lines, 'XtermPopup') | |
2475 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) | |
2476 call term_wait(buf, 200) | |
2477 call term_sendkeys(buf, ":set noruler\<CR>") | |
2478 call term_sendkeys(buf, ":call OpenTerm()\<CR>") | |
2479 call term_wait(buf, 100) | |
2480 call term_sendkeys(buf, "hello\<CR>") | |
2481 call VerifyScreenDump(buf, 'Test_terminal_popup_' .. a:group_name, {}) | |
2482 | |
2483 call term_sendkeys(buf, "\<C-D>") | |
2484 call term_wait(buf, 100) | |
2485 call term_sendkeys(buf, ":q\<CR>") | |
2486 call term_wait(buf, 100) " wait for terminal to vanish | |
2487 call StopVimInTerminal(buf) | |
2488 call delete('XtermPopup') | |
2489 endfunc | |
2490 | |
2491 func Test_terminal_in_popup_colored_Terminal() | |
2492 call Terminal_in_popup_colored("Terminal", "highlight Terminal ctermfg=blue ctermbg=yellow", "") | |
2493 endfunc | |
2494 | |
2495 func Test_terminal_in_popup_colored_group() | |
2496 call Terminal_in_popup_colored("MyTermCol", "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", "term_highlight: 'MyTermCol',") | |
2458 endfunc | 2497 endfunc |
2459 | 2498 |
2460 func Test_double_popup_terminal() | 2499 func Test_double_popup_terminal() |
2461 let buf1 = term_start(&shell, #{hidden: 1}) | 2500 let buf1 = term_start(&shell, #{hidden: 1}) |
2462 let win1 = popup_create(buf1, {}) | 2501 let win1 = popup_create(buf1, {}) |