Some time ago, i submitted a patch that makes colors bright for bold
text. Most Terminals do that, and some programs rely on this (like
htop). The patch was rejected unless more people ask for it.

As it seems, i'm still the only one, but i modified the patch to make
the bold-is-bright behavior optional. Now i try again.

I attached two variants of the patch, one uses preprocessor directives
(pp.diff), the other not. Maybe i'm more lucky this time :)

greetings
stefan
diff -r 054fe4c29819 st.c
--- a/st.c	Fri Apr 01 09:35:38 2011 +0200
+++ b/st.c	Fri Apr 01 10:37:54 2011 +0200
@@ -1573,8 +1573,17 @@
 
 	if(base.mode & ATTR_REVERSE)
 		xfg = dc.col[base.bg], xbg = dc.col[base.fg];
+#ifndef BOLD_IS_BRIGHT
 	else
 		xfg = dc.col[base.fg], xbg = dc.col[base.bg];
+#else
+    	else {
+    		if(base.mode & ATTR_BOLD && BETWEEN(base.fg, 0, 7))
+    			xfg = dc.col[base.fg+8], xbg = dc.col[base.bg];
+    		else
+    			xfg = dc.col[base.fg], xbg = dc.col[base.bg];
+    	}
+#endif
 
 	XSetBackground(xw.dpy, dc.gc, xbg);
 	XSetForeground(xw.dpy, dc.gc, xfg);
diff -r 054fe4c29819 st.c
--- a/st.c	Fri Apr 01 09:35:38 2011 +0200
+++ b/st.c	Fri Apr 01 10:42:03 2011 +0200
@@ -1573,8 +1573,16 @@
 
 	if(base.mode & ATTR_REVERSE)
 		xfg = dc.col[base.bg], xbg = dc.col[base.fg];
-	else
-		xfg = dc.col[base.fg], xbg = dc.col[base.bg];
+	else {
+		if(!bright_as_bold) {
+			xfg = dc.col[base.fg], xbg = dc.col[base.bg];
+		} else {
+    			if(base.mode & ATTR_BOLD && BETWEEN(base.fg, 0, 7))
+    				xfg = dc.col[base.fg+8], xbg = dc.col[base.bg];
+    			else
+    				xfg = dc.col[base.fg], xbg = dc.col[base.bg];
+    		}
+    	}
 
 	XSetBackground(xw.dpy, dc.gc, xbg);
 	XSetForeground(xw.dpy, dc.gc, xfg);

Reply via email to