0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.0831: with 8 colors the bold attribute is not set properly

Problem:    With 8 colors the bold attribute is not set properly.
Solution:   Move setting HL_TABLE() out of lookup_color. (closes #1901)
This commit is contained in:
Bram Moolenaar
2017-08-01 18:04:04 +02:00
parent aaef1bae3c
commit 12d853fae1
4 changed files with 51 additions and 28 deletions

View File

@@ -7276,9 +7276,11 @@ static int color_numbers_8[28] = {0, 4, 2, 6,
/*
* Lookup the "cterm" value to be used for color with index "idx" in
* color_names[].
* "boldp" will be set to TRUE or FALSE for a foreground color when using 8
* colors, otherwise it will be unchanged.
*/
int
lookup_color(int idx, int foreground)
lookup_color(int idx, int foreground, int *boldp)
{
int color = color_numbers_16[idx];
char_u *p;
@@ -7300,12 +7302,9 @@ lookup_color(int idx, int foreground)
/* set/reset bold attribute to get light foreground
* colors (on some terminals, e.g. "linux") */
if (color & 8)
{
HL_TABLE()[idx].sg_cterm |= HL_BOLD;
HL_TABLE()[idx].sg_cterm_bold = TRUE;
}
*boldp = TRUE;
else
HL_TABLE()[idx].sg_cterm &= ~HL_BOLD;
*boldp = FALSE;
}
color &= 7; /* truncate to 8 colors */
}
@@ -7837,6 +7836,8 @@ do_highlight(
}
else
{
int bold = MAYBE;
#if defined(__QNXNTO__)
static int *color_numbers_8_qansi = color_numbers_8;
/* On qnx, the 8 & 16 color arrays are the same */
@@ -7857,7 +7858,17 @@ do_highlight(
break;
}
color = lookup_color(i, key[5] == 'F');
color = lookup_color(i, key[5] == 'F', &bold);
/* set/reset bold attribute to get light foreground
* colors (on some terminals, e.g. "linux") */
if (bold == TRUE)
{
HL_TABLE()[idx].sg_cterm |= HL_BOLD;
HL_TABLE()[idx].sg_cterm_bold = TRUE;
}
else if (bold == FALSE)
HL_TABLE()[idx].sg_cterm &= ~HL_BOLD;
}
/* Add one to the argument, to avoid zero. Zero is used for