Commit 0cd833e6 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tweaks: move a function to its proper location

Put it after the function that it calls, and before the functions
it is called from.
No related merge requests found
Showing with 28 additions and 29 deletions
+28 -29
......@@ -471,7 +471,6 @@ int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */
#ifdef ENABLE_NANORC
#ifdef ENABLE_COLOR
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
#endif
void parse_rcfile(FILE *rcstream, bool syntax_only);
......
......@@ -609,6 +609,34 @@ short color_to_short(const char *colorname, bool *bright)
return -2;
}
/* 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, ',');
if (comma != NULL) {
*bg = color_to_short(comma + 1, bright);
if (*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 (*fg == -2)
return FALSE;
} else
*fg = -1;
return TRUE;
}
/* Parse the color string in the line at ptr, and add it to the current
* file's associated colors. rex_flags are the regex compilation flags
* to use, excluding or including REG_ICASE for case (in)sensitivity. */
......@@ -736,34 +764,6 @@ void parse_colors(char *ptr, int rex_flags)
}
}
/* 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, ',');
if (comma != NULL) {
*bg = color_to_short(comma + 1, bright);
if (*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 (*fg == -2)
return FALSE;
} else
*fg = -1;
return TRUE;
}
/* Parse the argument of an interface color option. */
colortype *parse_interface_color(char *combostr)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment