rcfile: skip color commands where some color name is invalid
That is, do not fall back to the default background color when the name for the background color is invalid, but reject the entire color command, just like for an invalid foreground color.master
parent
9fcfee18e8
commit
cbf226476d
10
src/rcfile.c
10
src/rcfile.c
|
@ -736,7 +736,8 @@ void parse_colors(char *ptr, int rex_flags)
|
|||
}
|
||||
}
|
||||
|
||||
/* Parse the color name, or pair of color names, in combostr. */
|
||||
/* Parse the color name (or pair of color names) in the given string.
|
||||
* Return FALSE when any color name is invalid; otherwise return TRUE. */
|
||||
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
|
||||
{
|
||||
char *comma = strchr(combostr, ',');
|
||||
|
@ -747,22 +748,19 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
|
|||
rcfile_error(N_("A background color cannot be bright"));
|
||||
return FALSE;
|
||||
}
|
||||
if (*bg == -2)
|
||||
return FALSE;
|
||||
*comma = '\0';
|
||||
} else
|
||||
*bg = -1;
|
||||
|
||||
if (comma != combostr) {
|
||||
*fg = color_to_short(combostr, bright);
|
||||
|
||||
/* If the specified foreground color is bad, ignore the regexes. */
|
||||
if (*fg == -2)
|
||||
return FALSE;
|
||||
} else
|
||||
*fg = -1;
|
||||
|
||||
if (*bg == -2)
|
||||
*bg = -1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue