To: vim_dev@googlegroups.com Subject: Patch 8.1.1161 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1161 Problem: Unreachable code. Solution: Remove condition that will never be true. Add tests for all ANSI colors. Files: src/terminal.c, src/testdir/test_terminal.vim, src/testdir/dumps/Test_terminal_all_ansi_colors.dump *** ../vim-8.1.1160/src/terminal.c 2019-04-11 11:40:08.023371343 +0200 --- src/terminal.c 2019-04-12 21:46:30.819063896 +0200 *************** *** 2432,2441 **** if (color->ansi_index != VTERM_ANSI_INDEX_NONE) { ! /* First 16 colors and default: use the ANSI index, because these ! * colors can be redefined, we use the RGB values. */ ! if (t_colors > 256) ! return color->ansi_index; switch (color->ansi_index) { case 0: return 0; --- 2432,2438 ---- if (color->ansi_index != VTERM_ANSI_INDEX_NONE) { ! // The first 16 colors and default: use the ANSI index. switch (color->ansi_index) { case 0: return 0; *** ../vim-8.1.1160/src/testdir/test_terminal.vim 2019-04-09 21:17:28.837660254 +0200 --- src/testdir/test_terminal.vim 2019-04-12 22:20:58.870655719 +0200 *************** *** 1484,1489 **** --- 1484,1540 ---- exe buf . 'bwipe' 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\") + call StopVimInTerminal(buf) + call delete('Xcolorscript') + endfunc + func Test_terminal_termwinsize_option_fixed() if !CanRunVimInTerminal() return *** ../vim-8.1.1160/src/testdir/dumps/Test_terminal_all_ansi_colors.dump 2019-04-12 22:26:54.756593491 +0200 --- src/testdir/dumps/Test_terminal_all_ansi_colors.dump 2019-04-12 22:21:18.058545398 +0200 *************** *** 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| *** ../vim-8.1.1160/src/version.c 2019-04-12 21:42:48.692539315 +0200 --- src/version.c 2019-04-12 22:11:11.485946804 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1161, /**/ -- hundred-and-one symptoms of being an internet addict: 265. Your reason for not staying in touch with family is that they do not have e-mail addresses. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///