mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-01 17:07:06 +03:00
tweaks: call init_pair() just once for each pair number
This commit is contained in:
parent
34528db096
commit
43a1756783
11
src/color.c
11
src/color.c
@ -108,11 +108,14 @@ void set_interface_colorpairs(void)
|
|||||||
/* Initialize the color pairs for the current syntax. */
|
/* Initialize the color pairs for the current syntax. */
|
||||||
void prepare_palette(void)
|
void prepare_palette(void)
|
||||||
{
|
{
|
||||||
const colortype *ink;
|
short number = NUMBER_OF_ELEMENTS;
|
||||||
|
|
||||||
/* For each coloring expression, initialize the color pair. */
|
/* For each unique pair number, tell ncurses the combination of colors. */
|
||||||
for (ink = openfile->syntax->color; ink != NULL; ink = ink->next)
|
for (colortype *ink = openfile->syntax->color; ink != NULL; ink = ink->next)
|
||||||
init_pair(ink->pairnum, ink->fg, ink->bg);
|
if (ink->pairnum > number) {
|
||||||
|
init_pair(ink->pairnum, ink->fg, ink->bg);
|
||||||
|
number = ink->pairnum;
|
||||||
|
}
|
||||||
|
|
||||||
have_palette = TRUE;
|
have_palette = TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user