nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 3899a09deaa59aba3e7aab6cf375664bd2a5c352
parent b535714671fe24a59ce4b826125daa10f001dc2d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 11 Jun 2020 19:18:24 +0200

tweaks: rename a variable, improve a comment, and reshuffle a few things

Diffstat:
Msrc/color.c | 19+++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/color.c b/src/color.c @@ -38,24 +38,19 @@ #define A_BANDAID A_NORMAL #endif -/* Assign pair numbers for the colors in the given syntax, giving identical - * color pairs the same number. */ +/* Assign a pair number to each of the foreground/background color combinations + * in the given syntax, giving identical combinations the same number. */ void set_syntax_colorpairs(syntaxtype *sntx) { int new_number = NUMBER_OF_ELEMENTS + 1; - colortype *ink; - for (ink = sntx->color; ink != NULL; ink = ink->next) { - const colortype *beforenow = sntx->color; + for (colortype *ink = sntx->color; ink != NULL; ink = ink->next) { + colortype *earlier = sntx->color; - while (beforenow != ink && (beforenow->fg != ink->fg || - beforenow->bg != ink->bg)) - beforenow = beforenow->next; + while (earlier != ink && (earlier->fg != ink->fg || earlier->bg != ink->bg)) + earlier = earlier->next; - if (beforenow != ink) - ink->pairnum = beforenow->pairnum; - else - ink->pairnum = new_number++; + ink->pairnum = (earlier != ink) ? earlier->pairnum : new_number++; ink->attributes |= COLOR_PAIR(ink->pairnum) | A_BANDAID; }