Re: col_inverse_bg=0 && col_inverse_fg=7
Thomas Dickey <[email protected]> Sat, 13 Nov 2010 08:30:04 -0500 (EST)
| Newsgroups | gmane.network.tin.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 13 Nov 2010, Dennis Preiser wrote:
> On Sat, Nov 13, 2010 at 07:48:02AM -0500, Thomas Dickey wrote:
>> On Sat, 13 Nov 2010, Dennis Preiser wrote:
>>> 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).
>>
>> something like that (I'd be inclined to fold the two if-lines together
>> by defining DEFAULT_FCOL and DEFAULT_BCOL somewhere, and using those
>> for cases like this).
>
> Thanks. Initially, default_fcol is 7 and default_bcol is 0. This changes
> to -1/-1 only when use_default_colors() succeeds. So the diff shrinks
> to:
>
> 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-13 14:08:08.000000000 +0100
> @@ -110,8 +110,7 @@ set_colors(
> if (bcolor > 0)
> bcolor %= COLORS;
>
> - /* curses assumes white/black */
> - if (fcolor != COLOR_WHITE || bcolor != COLOR_BLACK) {
> + if (fcolor != default_fcol || bcolor != default_bcol) {
> struct LIST *p;
> t_bool found = FALSE;
>
>
> Can we assume that curses always define COLOR_WHITE 7 and COLOR_BLACK 0?
yes - works everywhere that I'm aware of (we're not supporting non-color
curses).
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net