From: Bruno Haible Date: Thu, 30 Nov 2006 13:28:27 +0000 (+0000) Subject: Fix reversed red<->blue color channels. X-Git-Tag: v0.17~617 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1489fbb4149742a237e7d45641f3a4a620383fe7;p=thirdparty%2Fgettext.git Fix reversed red<->blue color channels. --- diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog index 7ec42f392..a31eb4a2d 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,3 +1,7 @@ +2006-11-28 Bruno Haible + + * lib/term-ostream.oo.c (out_attr_change): Fix uses of color_bgr. + 2006-11-28 Bruno Haible Guard against interruption with Ctrl-Z. diff --git a/gnulib-local/lib/term-ostream.oo.c b/gnulib-local/lib/term-ostream.oo.c index 6f5834952..9269b3a62 100644 --- a/gnulib-local/lib/term-ostream.oo.c +++ b/gnulib-local/lib/term-ostream.oo.c @@ -285,7 +285,9 @@ equal_attributes (attributes_t attr1, attributes_t attr2) && attr1.underline == attr2.underline); } -/* Convert a color in RGB encoding to BGR encoding. */ +/* Convert a color in RGB encoding to BGR encoding. + See the ncurses terminfo.5 manual page, section "Color Handling", for an + explanation why this is needed. */ static inline int color_bgr (term_color_t color) { @@ -329,9 +331,10 @@ out_attr_change (term_ostream_t stream, assert (stream->supports_foreground); assert (new_attr.color != COLOR_DEFAULT); if (stream->set_a_foreground != NULL) - tputs (tparm (stream->set_a_foreground, new_attr.color), 1, out_char); + tputs (tparm (stream->set_a_foreground, color_bgr (new_attr.color)), + 1, out_char); else - tputs (tparm (stream->set_foreground, color_bgr (new_attr.color)), + tputs (tparm (stream->set_foreground, new_attr.color), 1, out_char); } if (new_attr.bgcolor != old_attr.bgcolor) @@ -339,9 +342,10 @@ out_attr_change (term_ostream_t stream, assert (stream->supports_background); assert (new_attr.bgcolor != COLOR_DEFAULT); if (stream->set_a_background != NULL) - tputs (tparm (stream->set_a_background, new_attr.bgcolor), 1, out_char); + tputs (tparm (stream->set_a_background, color_bgr (new_attr.bgcolor)), + 1, out_char); else - tputs (tparm (stream->set_background, color_bgr (new_attr.bgcolor)), + tputs (tparm (stream->set_background, new_attr.bgcolor), 1, out_char); }