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.
master
Benno Schulenberg 2020-06-13 13:58:31 +02:00
parent 454dc6e1ec
commit c79b52da1d
1 changed files with 7 additions and 8 deletions

View File

@ -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);
}