--- termcap.c.blackisblue 2002-07-22 18:15:08.000000000 -0700 +++ termcap.c 2002-07-22 18:43:27.000000000 -0700 @@ -820,8 +820,6 @@ * We'll try just preferring AF and hoping it always agrees with COLOR_FOO, * and falling back to Sf if AF isn't defined. * - * In any case, treat black specially so we don't try to display black - * characters on the assumed black background. */ /* `curses' is aptly named; various versions don't like these @@ -839,10 +837,9 @@ extern char *tparm(); #endif -# ifdef COLOR_BLACK /* trust include file */ -#undef COLOR_BLACK -# else +# ifndef COLOR_BLACK /* trust include file */ # ifndef _M_UNIX /* guess BGR */ +#define COLOR_BLACK 0 #define COLOR_BLUE 1 #define COLOR_GREEN 2 #define COLOR_CYAN 3 @@ -851,6 +848,7 @@ #define COLOR_YELLOW 6 #define COLOR_WHITE 7 # else /* guess RGB */ +#define COLOR_BLACK 0 #define COLOR_RED 1 #define COLOR_GREEN 2 #define COLOR_YELLOW 3 @@ -860,7 +858,6 @@ #define COLOR_WHITE 7 # endif # endif -#define COLOR_BLACK COLOR_BLUE const int ti_map[8] = { COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, @@ -883,16 +880,18 @@ for (c = 0; c < CLR_MAX / 2; c++) { scratch = tparm(setf, ti_map[c]); - if (c != CLR_GRAY) { + if (c != CLR_GRAY && c != CLR_BLACK) { hilites[c] = (char *) alloc(strlen(scratch) + 1); Strcpy(hilites[c], scratch); + } else if (c == CLR_BLACK) { + /* use bright black (dark gray) for black */ + hilites[c] = (char *) alloc(strlen(scratch)+strlen(MD)+1); + Strcpy(hilites[c], MD); + Strcat(hilites[c], scratch); } - if (c != CLR_BLACK) { - hilites[c|BRIGHT] = (char*) alloc(strlen(scratch)+strlen(MD)+1); - Strcpy(hilites[c|BRIGHT], MD); - Strcat(hilites[c|BRIGHT], scratch); - } - + hilites[c|BRIGHT] = (char *) alloc(strlen(scratch)+strlen(MD)+1); + Strcpy(hilites[c|BRIGHT], MD); + Strcat(hilites[c|BRIGHT], scratch); } }