curses: remove unnecessary special handling for dark gray
On terminals with at least 16 colors there should be no need for special handling dark gray. The curses code uses COLORS < 16, COLORS <= 16, COLORS > 16, or COLORS >= 16 at several places although I'm not sure if they are correct or which could possibly be off-by-one errors. But realistically in this case, we only need to distinguish between 8 color terminals and terminals supporting more than 8 colors as this will mean the terminal supports at least 256 colors.
This commit is contained in:
+5
-22
@@ -358,6 +358,11 @@ curses_init_nhcolors(void)
|
||||
|
||||
|
||||
if (COLORS >= 16) {
|
||||
# ifdef USE_DARKGRAY
|
||||
if (iflags.wc2_darkgray) {
|
||||
init_pair(1, COLOR_BLACK + 8, -1);
|
||||
}
|
||||
# endif
|
||||
init_pair(9, COLOR_WHITE, -1);
|
||||
init_pair(10, COLOR_RED + 8, -1);
|
||||
init_pair(11, COLOR_GREEN + 8, -1);
|
||||
@@ -367,18 +372,6 @@ curses_init_nhcolors(void)
|
||||
init_pair(15, COLOR_CYAN + 8, -1);
|
||||
init_pair(16, COLOR_WHITE + 8, -1);
|
||||
}
|
||||
|
||||
if (can_change_color()) {
|
||||
# ifdef USE_DARKGRAY
|
||||
if (COLORS > 16) {
|
||||
color_content(CURSES_DARK_GRAY, &orig_darkgray.r,
|
||||
&orig_darkgray.g, &orig_darkgray.b);
|
||||
init_color(CURSES_DARK_GRAY, 300, 300, 300);
|
||||
/* just override black colorpair entry here */
|
||||
init_pair(1, CURSES_DARK_GRAY, -1);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -857,14 +850,4 @@ curses_display_splash_window(void)
|
||||
void
|
||||
curses_cleanup(void)
|
||||
{
|
||||
#ifdef TEXTCOLOR
|
||||
if (has_colors() && can_change_color()) {
|
||||
# ifdef USE_DARKGRAY
|
||||
if (COLORS > 16) {
|
||||
init_color(CURSES_DARK_GRAY, orig_darkgray.r,
|
||||
orig_darkgray.g, orig_darkgray.b);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user