tweaks: use meaningful names instead of puzzling values
Suggested-by: Brand Huntsman <alpha@qzx.com>master
parent
a865c25eea
commit
0b30835dd0
|
@ -60,9 +60,9 @@ void set_colorpairs(void)
|
|||
colortype *combo = color_combo[i];
|
||||
|
||||
if (combo != NULL) {
|
||||
if (combo->fg == -1 && !using_defaults)
|
||||
if (combo->fg == USE_THE_DEFAULT && !using_defaults)
|
||||
combo->fg = COLOR_WHITE;
|
||||
if (combo->bg == -1 && !using_defaults)
|
||||
if (combo->bg == USE_THE_DEFAULT && !using_defaults)
|
||||
combo->bg = COLOR_BLACK;
|
||||
init_pair(i + 1, combo->fg, combo->bg);
|
||||
interface_color_pair[i] = COLOR_PAIR(i + 1) | A_BANDAID |
|
||||
|
@ -125,10 +125,10 @@ void color_init(void)
|
|||
foreground = ink->fg;
|
||||
background = ink->bg;
|
||||
|
||||
if (foreground == -1 && !using_defaults)
|
||||
if (foreground == USE_THE_DEFAULT && !using_defaults)
|
||||
foreground = COLOR_WHITE;
|
||||
|
||||
if (background == -1 && !using_defaults)
|
||||
if (background == USE_THE_DEFAULT && !using_defaults)
|
||||
background = COLOR_BLACK;
|
||||
|
||||
init_pair(ink->pairnum, foreground, background);
|
||||
|
|
|
@ -142,6 +142,11 @@
|
|||
#define REPLACING 1
|
||||
#define INREGION 2
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
#define USE_THE_DEFAULT -1
|
||||
#define BAD_COLOR -2
|
||||
#endif
|
||||
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
|
|
12
src/rcfile.c
12
src/rcfile.c
|
@ -603,10 +603,10 @@ short color_to_short(const char *colorname, bool *bright)
|
|||
else if (strcasecmp(colorname, "black") == 0)
|
||||
return COLOR_BLACK;
|
||||
else if (strcasecmp(colorname, "normal") == 0)
|
||||
return -1;
|
||||
return USE_THE_DEFAULT;
|
||||
|
||||
rcfile_error(N_("Color \"%s\" not understood"), colorname);
|
||||
return -2;
|
||||
return BAD_COLOR;
|
||||
}
|
||||
|
||||
/* Parse the color name (or pair of color names) in the given string.
|
||||
|
@ -621,18 +621,18 @@ 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)
|
||||
if (*bg == BAD_COLOR)
|
||||
return FALSE;
|
||||
*comma = '\0';
|
||||
} else
|
||||
*bg = -1;
|
||||
*bg = USE_THE_DEFAULT;
|
||||
|
||||
if (comma != combostr) {
|
||||
*fg = color_to_short(combostr, bright);
|
||||
if (*fg == -2)
|
||||
if (*fg == BAD_COLOR)
|
||||
return FALSE;
|
||||
} else
|
||||
*fg = -1;
|
||||
*fg = USE_THE_DEFAULT;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue