1
0
forked from aniani/vim

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)
This commit is contained in:
LemonBoy
2022-05-20 10:10:34 +01:00
committed by Bram Moolenaar
parent 1755a91851
commit b2b3acbf2b
9 changed files with 204 additions and 49 deletions

View File

@@ -2679,8 +2679,8 @@ func Test_range()
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()

View File

@@ -2012,10 +2012,16 @@ func Test_terminal_ansicolors_global()
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 @@ func Test_terminal_ansicolors_func()
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 @@ func Test_terminal_ansicolors_func()
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, []))