tweaks: call init_pair() just once for each pair number

master
Benno Schulenberg 2020-06-13 14:10:25 +02:00
parent 34528db096
commit 43a1756783
1 changed files with 7 additions and 4 deletions

View File

@ -108,11 +108,14 @@ void set_interface_colorpairs(void)
/* Initialize the color pairs for the current syntax. */
void prepare_palette(void)
{
const colortype *ink;
short number = NUMBER_OF_ELEMENTS;
/* For each coloring expression, initialize the color pair. */
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next)
init_pair(ink->pairnum, ink->fg, ink->bg);
/* For each unique pair number, tell ncurses the combination of colors. */
for (colortype *ink = openfile->syntax->color; ink != NULL; ink = ink->next)
if (ink->pairnum > number) {
init_pair(ink->pairnum, ink->fg, ink->bg);
number = ink->pairnum;
}
have_palette = TRUE;
}