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 #5818)
diff --git a/src/testdir/dumps/Test_terminal_popup_MyTermCol.dump b/src/testdir/dumps/Test_terminal_popup_MyTermCol.dump
new file mode 100644
index 0000000..82fcec7
--- /dev/null
+++ b/src/testdir/dumps/Test_terminal_popup_MyTermCol.dump
@@ -0,0 +1,15 @@
+|0+0&#ffffff0| @73
+|1| @73
+|2| @73
+|3| @73
+|4| @24|╔+0#0000001#ffd7ff255|═@19|╗| +0#0000000#ffffff0@26
+|5| @24|║+0#0000001#ffd7ff255|h+0#00e0003#5fd7ff255|e|l@1|o| @14|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|6| @24|║+0#0000001#ffd7ff255|h+0#00e0003#5fd7ff255|e|l@1|o| @14|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|7| @24|║+0#0000001#ffd7ff255> +0#00e0003#5fd7ff255@19|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|8| @24|║+0#0000001#ffd7ff255| +0#00e0003#5fd7ff255@19|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|9| @24|║+0#0000001#ffd7ff255| +0#00e0003#5fd7ff255@19|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|1|0| @23|╚+0#0000001#ffd7ff255|═@19|╝| +0#0000000#ffffff0@26
+|1@1| @72
+|1|2| @72
+|1|3| @72
+@75
diff --git a/src/testdir/dumps/Test_terminal_popup_Terminal.dump b/src/testdir/dumps/Test_terminal_popup_Terminal.dump
new file mode 100644
index 0000000..938b419
--- /dev/null
+++ b/src/testdir/dumps/Test_terminal_popup_Terminal.dump
@@ -0,0 +1,15 @@
+|0+0&#ffffff0| @73
+|1| @73
+|2| @73
+|3| @73
+|4| @24|╔+0#0000001#ffd7ff255|═@19|╗| +0#0000000#ffffff0@26
+|5| @24|║+0#0000001#ffd7ff255|h+0#4040ff13#ffff4012|e|l@1|o| @14|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|6| @24|║+0#0000001#ffd7ff255|h+0#4040ff13#ffff4012|e|l@1|o| @14|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|7| @24|║+0#0000001#ffd7ff255> +0#4040ff13#ffff4012@19|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|8| @24|║+0#0000001#ffd7ff255| +0#4040ff13#ffff4012@19|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|9| @24|║+0#0000001#ffd7ff255| +0#4040ff13#ffff4012@19|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26
+|1|0| @23|╚+0#0000001#ffd7ff255|═@19|╝| +0#0000000#ffffff0@26
+|1@1| @72
+|1|2| @72
+|1|3| @72
+@75
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index f3571d4..c48ff4e 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2434,7 +2434,6 @@
let lines = [
\ 'set t_u7=',
\ 'call setline(1, range(20))',
- \ 'hi PopTerm ctermbg=grey',
\ 'func OpenTerm()',
\ " let s:buf = term_start('cat Xtext', #{hidden: 1})",
\ ' let g:winid = popup_create(s:buf, #{ border: []})',
@@ -2457,6 +2456,46 @@
call delete('XtermPopup')
endfunc
+" Check a terminal in popup window with different colors
+func Terminal_in_popup_colored(group_name, highlight_cmd, highlight_opt)
+ CheckRunVimInTerminal
+ CheckUnix
+
+ let lines = [
+ \ 'set t_u7=',
+ \ 'call setline(1, range(20))',
+ \ 'func OpenTerm()',
+ \ " let s:buf = term_start('cat', #{hidden: 1, "
+ \ .. a:highlight_opt .. "})",
+ \ ' let g:winid = popup_create(s:buf, #{ border: []})',
+ \ 'endfunc',
+ \ a:highlight_cmd,
+ \ ]
+ call writefile(lines, 'XtermPopup')
+ let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
+ call term_wait(buf, 200)
+ call term_sendkeys(buf, ":set noruler\<CR>")
+ call term_sendkeys(buf, ":call OpenTerm()\<CR>")
+ call term_wait(buf, 100)
+ call term_sendkeys(buf, "hello\<CR>")
+ call VerifyScreenDump(buf, 'Test_terminal_popup_' .. a:group_name, {})
+
+ call term_sendkeys(buf, "\<C-D>")
+ call term_wait(buf, 100)
+ call term_sendkeys(buf, ":q\<CR>")
+ call term_wait(buf, 100) " wait for terminal to vanish
+ call StopVimInTerminal(buf)
+ call delete('XtermPopup')
+endfunc
+
+func Test_terminal_in_popup_colored_Terminal()
+ call Terminal_in_popup_colored("Terminal", "highlight Terminal ctermfg=blue ctermbg=yellow", "")
+endfunc
+
+func Test_terminal_in_popup_colored_group()
+ call Terminal_in_popup_colored("MyTermCol", "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", "term_highlight: 'MyTermCol',")
+endfunc
+
func Test_double_popup_terminal()
let buf1 = term_start(&shell, #{hidden: 1})
let win1 = popup_create(buf1, {})