Dennis Preiser
2010-11-13 09:16:07 UTC
While playing with colors I found the following issue which happens in
the USE_CURSES && HAVE_USE_DEFAULT_COLORS case:
It's not possible to set col_inverse_bg=0 (black) and col_inverse_fg=7
(white). tin uses the (terminal) default fg an bg colors instead and
thus the inverse bar gets 'invisible'. Steps to reproduce:
open 'xterm -fg yellow -bg blue', start tin
'M'enu
Draw -> instead of highlighted bar : OFF
Use inverse video for page headers : ON
Standard foreground color : Default
Standard background color : Default
Color for inverse text (foreground) : White
Color for inverse text (background) : Black
-> the inverse bar is 'invisible'.
What happens: During startup use_default_colors() (in
tcurses.c:InitScreen()) assign terminals fg and bg to color pair 0.
Later on, color.c:set_colors() checks if the given fcolor and bcolor
matches COLOR_WHITE and COLOR_BLACK. If so, color pair 0 is used.
Unfortunately, for HAVE_USE_DEFAULT_COLORS, color pair 0 may hold other
color informations. For col_inverse_bg=0 && col_inverse_fg=7 this
results in an inverse bar with standard fg/bg -> the bar is 'invisible'.
The following fixes this for me, alas I'm not an curses expert so I
might be wrong:
diff -urp tin-1.9.6/src/color.c tin-1.9.6_r2/src/color.c
--- tin-1.9.6/src/color.c 2010-05-07 16:00:53.000000000 +0200
+++ tin-1.9.6_r2/src/color.c 2010-11-12 18:01:32.000000000 +0100
@@ -110,8 +110,12 @@ set_colors(
if (bcolor > 0)
bcolor %= COLORS;
+# ifdef HAVE_USE_DEFAULT_COLORS
+ if (fcolor != default_fcol || bcolor != default_bcol) {
+# else
/* curses assumes white/black */
if (fcolor != COLOR_WHITE || bcolor != COLOR_BLACK) {
+# endif /* HAVE_USE_DEFAULT_COLORS */
struct LIST *p;
t_bool found = FALSE;
default_fcol and default_bcol are either white/black or, if
use_default_colors() succeeds, -1/-1 (default colors from terminal).
Dennis
the USE_CURSES && HAVE_USE_DEFAULT_COLORS case:
It's not possible to set col_inverse_bg=0 (black) and col_inverse_fg=7
(white). tin uses the (terminal) default fg an bg colors instead and
thus the inverse bar gets 'invisible'. Steps to reproduce:
open 'xterm -fg yellow -bg blue', start tin
'M'enu
Draw -> instead of highlighted bar : OFF
Use inverse video for page headers : ON
Standard foreground color : Default
Standard background color : Default
Color for inverse text (foreground) : White
Color for inverse text (background) : Black
-> the inverse bar is 'invisible'.
What happens: During startup use_default_colors() (in
tcurses.c:InitScreen()) assign terminals fg and bg to color pair 0.
Later on, color.c:set_colors() checks if the given fcolor and bcolor
matches COLOR_WHITE and COLOR_BLACK. If so, color pair 0 is used.
Unfortunately, for HAVE_USE_DEFAULT_COLORS, color pair 0 may hold other
color informations. For col_inverse_bg=0 && col_inverse_fg=7 this
results in an inverse bar with standard fg/bg -> the bar is 'invisible'.
The following fixes this for me, alas I'm not an curses expert so I
might be wrong:
diff -urp tin-1.9.6/src/color.c tin-1.9.6_r2/src/color.c
--- tin-1.9.6/src/color.c 2010-05-07 16:00:53.000000000 +0200
+++ tin-1.9.6_r2/src/color.c 2010-11-12 18:01:32.000000000 +0100
@@ -110,8 +110,12 @@ set_colors(
if (bcolor > 0)
bcolor %= COLORS;
+# ifdef HAVE_USE_DEFAULT_COLORS
+ if (fcolor != default_fcol || bcolor != default_bcol) {
+# else
/* curses assumes white/black */
if (fcolor != COLOR_WHITE || bcolor != COLOR_BLACK) {
+# endif /* HAVE_USE_DEFAULT_COLORS */
struct LIST *p;
t_bool found = FALSE;
default_fcol and default_bcol are either white/black or, if
use_default_colors() succeeds, -1/-1 (default colors from terminal).
Dennis