mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.1161: unreachable code
Problem: Unreachable code. Solution: Remove condition that will never be true. Add tests for all ANSI colors.
This commit is contained in:
@@ -2432,10 +2432,7 @@ color2index(VTermColor *color, int fg, int *boldp)
|
|||||||
|
|
||||||
if (color->ansi_index != VTERM_ANSI_INDEX_NONE)
|
if (color->ansi_index != VTERM_ANSI_INDEX_NONE)
|
||||||
{
|
{
|
||||||
/* First 16 colors and default: use the ANSI index, because these
|
// The first 16 colors and default: use the ANSI index.
|
||||||
* colors can be redefined, we use the RGB values. */
|
|
||||||
if (t_colors > 256)
|
|
||||||
return color->ansi_index;
|
|
||||||
switch (color->ansi_index)
|
switch (color->ansi_index)
|
||||||
{
|
{
|
||||||
case 0: return 0;
|
case 0: return 0;
|
||||||
|
10
src/testdir/dumps/Test_terminal_all_ansi_colors.dump
Normal file
10
src/testdir/dumps/Test_terminal_all_ansi_colors.dump
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
>A+0#0000001#e0e0e08@1|B+0#e000002#ff404010@1|C+0#00e0003#40ff4011@1|D+0#af5f00255#ffffff0@1|E+0#0000e05#4040ff13@1|F+0#e000e06#ff40ff14@1|G+0#00e0e07#40ffff15@1|H+0#e0e0e08#0000001@1|I+0#6c6c6c255#ffffff16@1|J+0#ff404010#e000002@1|K+0#40ff4011#00e0003@1|L+0#ffff4012#af5f00255@1|M+0#4040ff13#0000e05@1|N+0#ff40ff14#e000e06@1|O+0#40ffff15#00e0e07@1|P+0#ffffff16#6c6c6c255@1| +0#0000000#ffffff0@42
|
||||||
|
@2| +0#4040ff13&@72
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
| +0#0000000&@56|1|,|1| @10|A|l@1|
|
@@ -1484,6 +1484,57 @@ func Test_terminal_ansicolors_func()
|
|||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_terminal_all_ansi_colors()
|
||||||
|
if !CanRunVimInTerminal()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Use all the ANSI colors.
|
||||||
|
call writefile([
|
||||||
|
\ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP")',
|
||||||
|
\ 'hi Tblack ctermfg=Black ctermbg=Lightgrey',
|
||||||
|
\ 'hi Tdarkred ctermfg=Darkred ctermbg=Red',
|
||||||
|
\ 'hi Tdarkgreen ctermfg=Darkgreen ctermbg=Green',
|
||||||
|
\ 'hi Tbrown ctermfg=Brown ctermbg=Yello',
|
||||||
|
\ 'hi Tdarkblue ctermfg=Darkblue ctermbg=Blue',
|
||||||
|
\ 'hi Tdarkmagenta ctermfg=Darkmagenta ctermbg=Magenta',
|
||||||
|
\ 'hi Tdarkcyan ctermfg=Darkcyan ctermbg=Cyan',
|
||||||
|
\ 'hi Tlightgrey ctermfg=Lightgrey ctermbg=Black',
|
||||||
|
\ 'hi Tdarkgrey ctermfg=Darkgrey ctermbg=White',
|
||||||
|
\ 'hi Tred ctermfg=Red ctermbg=Darkred',
|
||||||
|
\ 'hi Tgreen ctermfg=Green ctermbg=Darkgreen',
|
||||||
|
\ 'hi Tyellow ctermfg=Yellow ctermbg=Brown',
|
||||||
|
\ 'hi Tblue ctermfg=Blue ctermbg=Darkblue',
|
||||||
|
\ 'hi Tmagenta ctermfg=Magenta ctermbg=Darkmagenta',
|
||||||
|
\ 'hi Tcyan ctermfg=Cyan ctermbg=Darkcyan',
|
||||||
|
\ 'hi Twhite ctermfg=White ctermbg=Darkgrey',
|
||||||
|
\ '',
|
||||||
|
\ 'call matchadd("Tblack", "A")',
|
||||||
|
\ 'call matchadd("Tdarkred", "B")',
|
||||||
|
\ 'call matchadd("Tdarkgreen", "C")',
|
||||||
|
\ 'call matchadd("Tbrown", "D")',
|
||||||
|
\ 'call matchadd("Tdarkblue", "E")',
|
||||||
|
\ 'call matchadd("Tdarkmagenta", "F")',
|
||||||
|
\ 'call matchadd("Tdarkcyan", "G")',
|
||||||
|
\ 'call matchadd("Tlightgrey", "H")',
|
||||||
|
\ 'call matchadd("Tdarkgrey", "I")',
|
||||||
|
\ 'call matchadd("Tred", "J")',
|
||||||
|
\ 'call matchadd("Tgreen", "K")',
|
||||||
|
\ 'call matchadd("Tyellow", "L")',
|
||||||
|
\ 'call matchadd("Tblue", "M")',
|
||||||
|
\ 'call matchadd("Tmagenta", "N")',
|
||||||
|
\ 'call matchadd("Tcyan", "O")',
|
||||||
|
\ 'call matchadd("Twhite", "P")',
|
||||||
|
\ 'redraw',
|
||||||
|
\ ], 'Xcolorscript')
|
||||||
|
let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10})
|
||||||
|
call VerifyScreenDump(buf, 'Test_terminal_all_ansi_colors', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":q\<CR>")
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('Xcolorscript')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_termwinsize_option_fixed()
|
func Test_terminal_termwinsize_option_fixed()
|
||||||
if !CanRunVimInTerminal()
|
if !CanRunVimInTerminal()
|
||||||
return
|
return
|
||||||
|
@@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1161,
|
||||||
/**/
|
/**/
|
||||||
1160,
|
1160,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user