commit c79b52da1dac8484b984e1946713be46c9d8b1d9
parent 454dc6e1ec9ca936ddc5657161cf410dde4cedb3
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 13 Jun 2020 13:58:31 +0200
tweaks: do the conversion of -1 to a specific color just once
Do the conversion (when needed) when the syntax is loaded,
not for each buffer switch.
Diffstat:
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/color.c b/src/color.c
@@ -50,6 +50,13 @@ void set_syntax_colorpairs(syntaxtype *sntx)
for (colortype *ink = sntx->color; ink != NULL; ink = ink->next) {
colortype *earlier = sntx->color;
+ if (!defaults_allowed) {
+ if (ink->fg == USE_THE_DEFAULT)
+ ink->fg = COLOR_WHITE;
+ if (ink->bg == USE_THE_DEFAULT)
+ ink->bg = COLOR_BLACK;
+ }
+
while (earlier != ink && (earlier->fg != ink->fg || earlier->bg != ink->bg))
earlier = earlier->next;
@@ -109,14 +116,6 @@ void prepare_palette(void)
foreground = ink->fg;
background = ink->bg;
- if (!defaults_allowed) {
- if (foreground == USE_THE_DEFAULT)
- foreground = COLOR_WHITE;
-
- if (background == USE_THE_DEFAULT)
- background = COLOR_BLACK;
- }
-
init_pair(ink->pairnum, foreground, background);
}