tweaks: move a function to its proper location
Put it after the function that it calls, and before the functions it is called from.master
parent
cbf226476d
commit
0cd833e64b
|
@ -471,7 +471,6 @@ int do_yesno_prompt(bool all, const char *msg);
|
||||||
/* Most functions in rcfile.c. */
|
/* Most functions in rcfile.c. */
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
#ifdef ENABLE_COLOR
|
#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);
|
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
||||||
#endif
|
#endif
|
||||||
void parse_rcfile(FILE *rcstream, bool syntax_only);
|
void parse_rcfile(FILE *rcstream, bool syntax_only);
|
||||||
|
|
56
src/rcfile.c
56
src/rcfile.c
|
@ -609,6 +609,34 @@ short color_to_short(const char *colorname, bool *bright)
|
||||||
return -2;
|
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
|
/* 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
|
* file's associated colors. rex_flags are the regex compilation flags
|
||||||
* to use, excluding or including REG_ICASE for case (in)sensitivity. */
|
* 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. */
|
/* Parse the argument of an interface color option. */
|
||||||
colortype *parse_interface_color(char *combostr)
|
colortype *parse_interface_color(char *combostr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue