patch 8.2.4982: colors in terminal window are not 100% correct
Problem: Colors in terminal window are not 100% correct.
Solution: Use g:terminal_ansi_colors as documented. (closes #10429,
closes #7227 closes #10347)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 9eae10d..68dbb0a 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2679,8 +2679,8 @@
else
let cmd = "ls"
endif
- call assert_fails('call term_start("' .. cmd .. '", #{term_finish: "close"})', 'E475:')
- unlet g:terminal_ansi_colors
+ call assert_fails('call term_start("' .. cmd .. '", #{term_finish: "close"'
+ \ .. ', ansi_colors: range(16)})', 'E475:')
endif
" type()
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index f290eff..2700b7a 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2012,10 +2012,16 @@
CheckFeature termguicolors
CheckFunction term_getansicolors
+ if has('vtp') && !has('vcon') && !has('gui_running')
+ throw 'Skipped: does not support termguicolors'
+ endif
+
+ set tgc
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
let buf = Run_shell_in_terminal({})
call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
call StopShellInTerminal(buf)
+ set tgc&
exe buf . 'bwipe'
unlet g:terminal_ansi_colors
@@ -2025,6 +2031,11 @@
CheckFeature termguicolors
CheckFunction term_getansicolors
+ if has('vtp') && !has('vcon') && !has('gui_running')
+ throw 'Skipped: does not support termguicolors'
+ endif
+
+ set tgc
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors})
call assert_equal(s:test_colors, term_getansicolors(buf))
@@ -2047,6 +2058,7 @@
let colors[4] = 'Invalid'
call assert_fails('call term_setansicolors(buf, colors)', 'E254:')
call assert_fails('call term_setansicolors(buf, {})', 'E714:')
+ set tgc&
call StopShellInTerminal(buf)
call assert_equal(0, term_setansicolors(buf, []))