Hello list.

A while ago I have noticed that some ncurses programs can
no longer show bright background colors.
Creating bright background colors with escape sequence,
although, is still possible.

I attached small ncurses program that displays
all combinations of foreground/background colors
with all combinations of basic attributes (normal, bold, blink, reverse)

I have used bisection method and I have found first broken revision,
that is: r213 (r212 is still good).

Simple diff shows that following patch causes the problem:

<--------- starts here
diff -ur r212/src/rxvt.h r213/src/rxvt.h
--- r212/src/rxvt.h     2007-10-23 16:03:02.000000000 +0200
+++ r213/src/rxvt.h     2007-10-23 16:10:54.000000000 +0200
@@ -1383,18 +1383,18 @@
 /* how to build & extract colors and attributes */
 #define GET_BASEFG(x)      (((x) & RS_fgMask))
 #define GET_BASEBG(x)      (((x) & RS_bgMask)>>Color_Bits)
-#ifndef NO_BRIGHTCOLOR
-# define GET_FGCOLOR(x)                            \
-    ((((x) & RS_Bold) == 0                 \
-      || GET_BASEFG(x) < minCOLOR              \
-      || GET_BASEFG(x) >= minBrightCOLOR)          \
-     ? GET_BASEFG(x)                       \
+#if 0 /* Was ifndef NO_BRIGHTCOLOR */
+# define GET_FGCOLOR(x)                                                    \
+    ((((x) & RS_Bold) == 0                                         \
+      || GET_BASEFG(x) < minCOLOR                                  \
+      || GET_BASEFG(x) >= minBrightCOLOR)                          \
+     ? GET_BASEFG(x)                                               \
      : (GET_BASEFG(x) + (minBrightCOLOR - minCOLOR)))
-# define GET_BGCOLOR(x)                            \
-    ((((x) & RS_Blink) == 0                \
-      || GET_BASEBG(x) < minCOLOR              \
-      || GET_BASEBG(x) >= minBrightCOLOR)          \
-     ? GET_BASEBG(x)                       \
+# define GET_BGCOLOR(x)                                                    \
+    ((((x) & RS_Blink) == 0                                        \
+      || GET_BASEBG(x) < minCOLOR                                  \
+      || GET_BASEBG(x) >= minBrightCOLOR)                          \
+     ? GET_BASEBG(x)                                               \
      : (GET_BASEBG(x) + (minBrightCOLOR - minCOLOR)))
 #else
 # define GET_FGCOLOR(x)            GET_BASEFG(x)
<---------- ends here

I hope you do not mind bringing back old behavior.
Thank you for your attention.

Best regards.

PS

To compile sample program simply invoke:

gcc -lncurses ncolor.c

-- 
  Huginn
GCS d? s:+>: a- C++$() UB++++$ P++ L++++$ E---
W+(-) N++ o? K? w-- O M- V- PS+ PE++ Y PGP-
t--- 5-- X- R !tv b++ DI++ D+ G e* h+
#include <ncurses.h>

int main( int argc, char** argv )
	{
	int i, j, k;
	short l_piColors [ ] = { COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
		COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE };
	int attrs[] =
		{
		A_NORMAL,
		A_REVERSE,
		A_BLINK,
		A_BOLD
		};
	initscr();
	start_color();
	for ( j = 0; j < 8; j ++ )
		for ( i = 0; i < 8; i ++ )
			init_pair ( ( short ) ( j * 8 + i ),
					l_piColors [ i ], l_piColors [ j ] );
	noecho();
	curs_set( 0 );
	for ( j = 0; j < ( 1 << ( sizeof ( attrs ) / sizeof ( int ) ) ); ++ j )
		{
		int attr = 0;
		for ( k = 0; k < ( sizeof ( attrs ) / sizeof ( int ) ); ++ k )
			attr |= ( ( 1 << k ) & j ) ? attrs[ k ] : 0;
		for ( i = 0; i < 64; ++ i )
			{
			move( j, i );
			attrset( COLOR_PAIR( i ) | attr );
			addch( '*' );
			}
		}
	getch();
	curs_set( 1 );
	endwin();
	return ( 0 );
	}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Materm-devel mailing list
Materm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/materm-devel
mrxvt home page: http://materm.sourceforge.net

Reply via email to