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

tweaks: use meaningful names instead of puzzling values

Suggested-by: default avatarBrand Huntsman <alpha@qzx.com>
parent a865c25e
Showing with 15 additions and 10 deletions
+15 -10
......@@ -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
......
......@@ -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;
}
......
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