<<< Date Index >>>     <<< Thread Index >>>

Re: Mutt & 256 colors re-re-re-visited



On Mon, Jan 29, 2007 at 10:44:32AM EST, Kyle Wheeler wrote:
> On Sunday, January 28 at 10:15 PM, quoth Mun Johl:
> >c> > Unfortunately, no.  When I run mutt I do first set TERM=rxvt 
> >prior to
> >c> > launching mutt.  I have verified via executing a shell command from mutt
> >c> > that the TERM is in fact set to rxvt.  I have also verified via a shell
> >c> > command that the output of 'tput colors' is 256 .
> >c> 
> >c> $ infocmp rxvt | grep colors
> >c> 
> >c> What does it say?
> >
> >colors#256, cols#80, it#8, lines#24, pairs#32717
> 
> What matters here is not the terminal, but the library.
> 
> The code in mutt that makes this decision is in color.c, around line 
> 325:
> 
>     if (ascii_strncasecmp (s, "color", 5) == 0)
>     {
>         s += 5;
>         *col = strtol (s, &eptr, 10);
>         if (!*s || *eptr || *col < 0 ||
>             (*col >= COLORS && !option(OPTNOCURSES) && has_colors()))
>         {
>             snprintf (err->data, err->dsize,
>                 _("%s": color not supported by term"), s);
>             return (-1);
>         }
>     }
> 
> As you can see, when parsing something like "color34", *col becomes 
> 34, and is checked against the value of COLORS. COLORS is a value 
> defined by ncurses and slang.

Yes, but wouldn't these libraries obtain the value of COLORS from
the terminfo entry pointed to by the process's TERM environment
variable?

Or in other words, in the event the colors# in the terminfo entry is <
color100 ..  wouldn't that result in the same snprintf?

> If the library doesn't support large numbers of colors, then mutt 
> won't either.

I use a 256-color capable xterm rather than rxvt but I find it strange
that the "rxvt" entry in the OP's terminfo database should default to
256 colors mainly because supporting this mode is a new functionality
and I don't see the maintainer changing the old "rxvt" entry .. might
break things .. I would have thought that same as for xterm he would
have added a new rxvt-256color entry to the database.

That's why I initially suspected the OP's problem was that his terminfo
entry did not correctly specify the terminal's 256-color capability.

But then the OP stated elsewhere that he is running Solaris 8 and that
may very well come with ncurses/slang libraries that do not support 256
colors .. 

But then .. where did this rxvt terminfo entry that specifies 256 colors
come from .. ??  I thought that would be part of the curses package and
should therefore by in sync' with the librar{y|ies} .. ?

Thanks.

cga