nano

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

commit 61c94c2f81f1f886476c6f60f4b792739475f3d6
parent 69a90dd7af869068878c494319b71b50f90fa234
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 17 Jun 2020 16:50:17 +0200

rcfile: report the first bad color element, not a later one that is okay

This fixes https://savannah.gnu.org/bugs/?58605.

Bug existed since commit c275c515 from several days ago.

Diffstat:
Msrc/rcfile.c | 20+++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/rcfile.c b/src/rcfile.c @@ -1066,17 +1066,10 @@ bool parse_combination(char *combostr, short *fg, short *bg, int *attributes) comma = strchr(combostr, ','); - if (comma != NULL) { - *bg = color_to_short(comma + 1, &vivid, &thick); - if (*bg == BAD_COLOR) - return FALSE; - if (vivid && COLORS > 8) - *bg += 8; + if (comma) *comma = '\0'; - } else - *bg = USE_THE_DEFAULT; - if (comma != combostr) { + if (!comma || comma > combostr) { *fg = color_to_short(combostr, &vivid, &thick); if (*fg == BAD_COLOR) return FALSE; @@ -1087,6 +1080,15 @@ bool parse_combination(char *combostr, short *fg, short *bg, int *attributes) } else *fg = USE_THE_DEFAULT; + if (comma) { + *bg = color_to_short(comma + 1, &vivid, &thick); + if (*bg == BAD_COLOR) + return FALSE; + if (vivid && COLORS > 8) + *bg += 8; + } else + *bg = USE_THE_DEFAULT; + return TRUE; }