tweaks: rename a variable, improve a comment, and reshuffle a few things
parent
b535714671
commit
3899a09dea
19
src/color.c
19
src/color.c
|
@ -38,24 +38,19 @@
|
||||||
#define A_BANDAID A_NORMAL
|
#define A_BANDAID A_NORMAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Assign pair numbers for the colors in the given syntax, giving identical
|
/* Assign a pair number to each of the foreground/background color combinations
|
||||||
* color pairs the same number. */
|
* in the given syntax, giving identical combinations the same number. */
|
||||||
void set_syntax_colorpairs(syntaxtype *sntx)
|
void set_syntax_colorpairs(syntaxtype *sntx)
|
||||||
{
|
{
|
||||||
int new_number = NUMBER_OF_ELEMENTS + 1;
|
int new_number = NUMBER_OF_ELEMENTS + 1;
|
||||||
colortype *ink;
|
|
||||||
|
|
||||||
for (ink = sntx->color; ink != NULL; ink = ink->next) {
|
for (colortype *ink = sntx->color; ink != NULL; ink = ink->next) {
|
||||||
const colortype *beforenow = sntx->color;
|
colortype *earlier = sntx->color;
|
||||||
|
|
||||||
while (beforenow != ink && (beforenow->fg != ink->fg ||
|
while (earlier != ink && (earlier->fg != ink->fg || earlier->bg != ink->bg))
|
||||||
beforenow->bg != ink->bg))
|
earlier = earlier->next;
|
||||||
beforenow = beforenow->next;
|
|
||||||
|
|
||||||
if (beforenow != ink)
|
ink->pairnum = (earlier != ink) ? earlier->pairnum : new_number++;
|
||||||
ink->pairnum = beforenow->pairnum;
|
|
||||||
else
|
|
||||||
ink->pairnum = new_number++;
|
|
||||||
|
|
||||||
ink->attributes |= COLOR_PAIR(ink->pairnum) | A_BANDAID;
|
ink->attributes |= COLOR_PAIR(ink->pairnum) | A_BANDAID;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue