Mercurial > vim
comparison src/testdir/test_terminal.vim @ 28919:99c1356f4210 v8.2.4982
patch 8.2.4982: colors in terminal window are not 100% correct
Commit: https://github.com/vim/vim/commit/b2b3acbf2b3ae29ecf517f03b46fbeadf0c1a905
Author: LemonBoy <thatlemon@gmail.com>
Date: Fri May 20 10:10:34 2022 +0100
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 https://github.com/vim/vim/issues/10429,
closes #7227 closes #10347)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 20 May 2022 11:15:04 +0200 |
parents | 0f1a0bef2c02 |
children | 74974ecddc8a |
comparison
equal
deleted
inserted
replaced
28918:ec2988a3b03c | 28919:99c1356f4210 |
---|---|
2010 | 2010 |
2011 func Test_terminal_ansicolors_global() | 2011 func Test_terminal_ansicolors_global() |
2012 CheckFeature termguicolors | 2012 CheckFeature termguicolors |
2013 CheckFunction term_getansicolors | 2013 CheckFunction term_getansicolors |
2014 | 2014 |
2015 if has('vtp') && !has('vcon') && !has('gui_running') | |
2016 throw 'Skipped: does not support termguicolors' | |
2017 endif | |
2018 | |
2019 set tgc | |
2015 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) | 2020 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) |
2016 let buf = Run_shell_in_terminal({}) | 2021 let buf = Run_shell_in_terminal({}) |
2017 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) | 2022 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) |
2018 call StopShellInTerminal(buf) | 2023 call StopShellInTerminal(buf) |
2024 set tgc& | |
2019 | 2025 |
2020 exe buf . 'bwipe' | 2026 exe buf . 'bwipe' |
2021 unlet g:terminal_ansi_colors | 2027 unlet g:terminal_ansi_colors |
2022 endfunc | 2028 endfunc |
2023 | 2029 |
2024 func Test_terminal_ansicolors_func() | 2030 func Test_terminal_ansicolors_func() |
2025 CheckFeature termguicolors | 2031 CheckFeature termguicolors |
2026 CheckFunction term_getansicolors | 2032 CheckFunction term_getansicolors |
2027 | 2033 |
2034 if has('vtp') && !has('vcon') && !has('gui_running') | |
2035 throw 'Skipped: does not support termguicolors' | |
2036 endif | |
2037 | |
2038 set tgc | |
2028 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) | 2039 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) |
2029 let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors}) | 2040 let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors}) |
2030 call assert_equal(s:test_colors, term_getansicolors(buf)) | 2041 call assert_equal(s:test_colors, term_getansicolors(buf)) |
2031 | 2042 |
2032 call term_setansicolors(buf, g:terminal_ansi_colors) | 2043 call term_setansicolors(buf, g:terminal_ansi_colors) |
2045 eval buf->term_setansicolors(colors) | 2056 eval buf->term_setansicolors(colors) |
2046 | 2057 |
2047 let colors[4] = 'Invalid' | 2058 let colors[4] = 'Invalid' |
2048 call assert_fails('call term_setansicolors(buf, colors)', 'E254:') | 2059 call assert_fails('call term_setansicolors(buf, colors)', 'E254:') |
2049 call assert_fails('call term_setansicolors(buf, {})', 'E714:') | 2060 call assert_fails('call term_setansicolors(buf, {})', 'E714:') |
2061 set tgc& | |
2050 | 2062 |
2051 call StopShellInTerminal(buf) | 2063 call StopShellInTerminal(buf) |
2052 call assert_equal(0, term_setansicolors(buf, [])) | 2064 call assert_equal(0, term_setansicolors(buf, [])) |
2053 exe buf . 'bwipe' | 2065 exe buf . 'bwipe' |
2054 endfunc | 2066 endfunc |