]> granicus.if.org Git - vim/commitdiff
patch 8.1.1330: using bold attribute in terminal changes the color v8.1.1330
authorBram Moolenaar <Bram@vim.org>
Mon, 13 May 2019 18:27:23 +0000 (20:27 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 13 May 2019 18:27:23 +0000 (20:27 +0200)
Problem:    Using bold attribute in terminal changes the color. (Jason
            Franklin)
Solution:   Don't set the "bold-highbright" flag in vterm unless the terminal
            supports less than 16 colors.

src/terminal.c
src/testdir/dumps/Test_terminal_all_ansi_colors.dump
src/testdir/test_terminal.vim
src/version.c

index bc57d641fad55b08c9f373b19430f18e92608c9c..caa4c857341a89c392809346fcaf89bee41fb5f3 100644 (file)
@@ -3976,7 +3976,9 @@ create_vterm(term_T *term, int rows, int cols)
            &term->tl_default_color.fg,
            &term->tl_default_color.bg);
 
-    if (t_colors >= 16)
+    if (t_colors < 16)
+       // Less than 16 colors: assume that bold means using a bright color for
+       // the foreground color.
        vterm_state_set_bold_highbright(vterm_obtain_state(vterm), 1);
 
     /* Required to initialize most things. */
index 232f60d8488720f3a9ce109215b3233136df3b22..57a085aa8e1ed244a65d1a322a2a279fa7f9d359 100644 (file)
@@ -1,4 +1,4 @@
->A+0#0000001#8080809@1|B+0#e000002#ff404010@1|C+0#00e0003#40ff4011@1|D+0#e0e0004#ffff4012@1|E+0#0000e05#4040ff13@1|F+0#e000e06#ff40ff14@1|G+0#00e0e07#40ffff15@1|H+0#e0e0e08#ffffff16@1|I+0#8080809#0000001@1|J+0#ff404010#e000002@1|K+0#40ff4011#00e0003@1|L+0#ffff4012#e0e0004@1|M+0#4040ff13#0000e05@1|N+0#ff40ff14#e000e06@1|O+0#40ffff15#00e0e07@1|P+0#ffffff16#e0e0e08@1| +0#0000000#ffffff0@42
+>A+0#0000001#8080809@1|B+0#e000002#ff404010@1|C+0#00e0003#40ff4011@1|D+0#e0e0004#ffff4012@1|E+0#0000e05#4040ff13@1|F+0#e000e06#ff40ff14@1|G+0#00e0e07#40ffff15@1|H+0#e0e0e08#ffffff16@1|I+0#8080809#0000001@1|J+0#ff404010#e000002@1|K+0#40ff4011#00e0003@1|L+0#ffff4012#e0e0004@1|M+0#4040ff13#0000e05@1|N+0#ff40ff14#e000e06@1|O+0#40ffff15#00e0e07@1|P+0#ffffff16#e0e0e08@1| +0#0000000#ffffff0|X+2#e000002&@1|Y+2#40ff4011&@1|Z+2#ff40ff14#e000e06@1| +0#0000000#ffffff0@35
 @2| +0#4040ff13&@72
 |~| @73
 |~| @73
index 36e513e30dde3f39aa6be11d0ae19630f89fb90b..fcad972b1a25c1e7caf839e75914c4716e591dbf 100644 (file)
@@ -1491,7 +1491,7 @@ func Test_terminal_all_ansi_colors()
 
   " Use all the ANSI colors.
   call writefile([
-       \ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP")',
+       \ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP XXYYZZ")',
        \ 'hi Tblack ctermfg=0 ctermbg=8',
        \ 'hi Tdarkred ctermfg=1 ctermbg=9',
        \ 'hi Tdarkgreen ctermfg=2 ctermbg=10',
@@ -1508,6 +1508,9 @@ func Test_terminal_all_ansi_colors()
        \ 'hi Tmagenta ctermfg=13 ctermbg=5',
        \ 'hi Tcyan ctermfg=14 ctermbg=6',
        \ 'hi Twhite ctermfg=15 ctermbg=7',
+       \ 'hi TdarkredBold ctermfg=1 cterm=bold',
+       \ 'hi TgreenBold ctermfg=10 cterm=bold',
+       \ 'hi TmagentaBold ctermfg=13 cterm=bold ctermbg=5',
        \ '',
        \ 'call  matchadd("Tblack", "A")',
        \ 'call  matchadd("Tdarkred", "B")',
@@ -1525,6 +1528,9 @@ func Test_terminal_all_ansi_colors()
        \ 'call  matchadd("Tmagenta", "N")',
        \ 'call  matchadd("Tcyan", "O")',
        \ 'call  matchadd("Twhite", "P")',
+       \ 'call  matchadd("TdarkredBold", "X")',
+       \ 'call  matchadd("TgreenBold", "Y")',
+       \ 'call  matchadd("TmagentaBold", "Z")',
        \ 'redraw',
        \ ], 'Xcolorscript')
   let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10})
index 8defe6a77a8409d179cfb45b271832c81e76e2a1..9ce9ab42238b1dcd55b6b81554e3e9f5865604e8 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1330,
 /**/
     1329,
 /**/