curses fix: map our normal color pairs into the 0-7 range instead of 1-8,
authorNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 22:47:17 +0000 (22:47 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 22:47:17 +0000 (22:47 +0000)
in order to make our pairs fit on terminals such as dtterm where COLOR_PAIRS=8.
map the white/blue color pair onto 8 instead of 9, but only if that slot
is available; fall back on white/black otherwise.

it seems there may be an off-by-one error in the color pair manpages for
the various curses packages (?) if not, our 0 entry is unusable, but that's
the DIM_BLACK color and we don't use it anyway.

citadel/ChangeLog
citadel/screen.c

index 65db734153880094311e1eb421f42787af44db05..5153ceb1041135f9d2e53105edf6fe872390794d 100644 (file)
@@ -1,4 +1,14 @@
  $Log$
+ Revision 590.148  2002/03/12 22:47:17  nbryant
+ curses fix: map our normal color pairs into the 0-7 range instead of 1-8,
+ in order to make our pairs fit on terminals such as dtterm where COLOR_PAIRS=8.
+ map the white/blue color pair onto 8 instead of 9, but only if that slot
+ is available; fall back on white/black otherwise.
+
+ it seems there may be an off-by-one error in the color pair manpages for
+ the various curses packages (?) if not, our 0 entry is unusable, but that's
+ the DIM_BLACK color and we don't use it anyway.
+
  Revision 590.147  2002/03/12 22:17:20  ajc
  * Give mailbox owners access to "who knows room" command
 
@@ -3467,3 +3477,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 210895838f908bf938ae0d88f7ed562aa2ef7e0b..a8fd02855d19b02a458c2956de7d67e2a7732767 100644 (file)
@@ -90,17 +90,17 @@ void screen_new(void)
                start_color();
                if (rc_ansi_color)
                        enable_color = 1;
-               init_pair(1+DIM_BLACK, COLOR_BLACK, COLOR_BLACK);
-               init_pair(1+DIM_RED, COLOR_RED, COLOR_BLACK);
-               init_pair(1+DIM_GREEN, COLOR_GREEN, COLOR_BLACK);
-               init_pair(1+DIM_YELLOW, COLOR_YELLOW, COLOR_BLACK);
-               init_pair(1+DIM_BLUE, COLOR_BLUE, COLOR_BLACK);
-               init_pair(1+DIM_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
-               init_pair(1+DIM_CYAN, COLOR_CYAN, COLOR_BLACK);
-               init_pair(1+DIM_WHITE, COLOR_WHITE, COLOR_BLACK);
+               init_pair(DIM_BLACK, COLOR_BLACK, COLOR_BLACK);
+               init_pair(DIM_RED, COLOR_RED, COLOR_BLACK);
+               init_pair(DIM_GREEN, COLOR_GREEN, COLOR_BLACK);
+               init_pair(DIM_YELLOW, COLOR_YELLOW, COLOR_BLACK);
+               init_pair(DIM_BLUE, COLOR_BLUE, COLOR_BLACK);
+               init_pair(DIM_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
+               init_pair(DIM_CYAN, COLOR_CYAN, COLOR_BLACK);
+               init_pair(DIM_WHITE, COLOR_WHITE, COLOR_BLACK);
 
                if (COLOR_PAIRS > 8)
-                       init_pair(9, COLOR_WHITE, COLOR_BLUE);
+                       init_pair(8, COLOR_WHITE, COLOR_BLUE);
        } else
 #endif /* HAVE_CURSES_H */
        {
@@ -339,9 +339,9 @@ int scr_color(int colornum)
 #ifdef HAVE_CURSES_H
        if (mainwindow) {
 #ifdef HAVE_WCOLOR_SET
-               wcolor_set(mainwindow, 1 + (colornum & 7), NULL);
+               wcolor_set(mainwindow, (colornum & 7), NULL);
 #else
-               wattron(mainwindow, COLOR_PAIR(1 + (colornum & 7)));
+               wattron(mainwindow, COLOR_PAIR((colornum & 7)));
 #endif
                if (colornum & 8) {
                        wattron(mainwindow, A_BOLD);
@@ -436,7 +436,9 @@ void windows_new(void)
                statuswindow = newwin(1, x, y - 1, 0);
 
                if (COLOR_PAIRS > 8)
-                       wbkgdset(statuswindow, COLOR_PAIR(9));
+                       wbkgdset(statuswindow, ' ' | COLOR_PAIR(8));
+               else
+                       wbkgdset(statuswindow, ' ' | COLOR_PAIR(DIM_WHITE));
 
                werase(statuswindow);
                immedok(statuswindow, FALSE);