summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-01 18:04:04 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-01 18:04:04 +0200
commit12d853fae1fc37c33874b5cf1e40a2dfaf04268c (patch)
treef19aabe7d663b077895bcf29abda23e8cc0d36a5 /src/syntax.c
parentaaef1bae3cc331e7a7bb9c698e707c90cd4ded15 (diff)
downloadvim-git-12d853fae1fc37c33874b5cf1e40a2dfaf04268c.tar.gz
patch 8.0.0831: with 8 colors the bold attribute is not set properlyv8.0.0831
Problem: With 8 colors the bold attribute is not set properly. Solution: Move setting HL_TABLE() out of lookup_color. (closes #1901)
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/syntax.c b/src/syntax.c
index e026c4400..a4c0340a4 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -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