nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] bright colors without bold


From: Brand Huntsman
Subject: Re: [Nano-devel] [PATCH] bright colors without bold
Date: Wed, 7 Feb 2018 19:04:28 -0700

On Wed, 31 Jan 2018 21:01:54 +0100
Benno Schulenberg <address@hidden> wrote:

> +/* Get number of colors supported by terminal and initialize lookup
> tables. */ +void extended_color_init(void)
> 
> What lookup tables?

The lookup tables added by the RGB patch. I moved that part of the comment out 
of this patch.


> +   if (!has_colors())
> +       nr_term_colors = 0;
> +
> +   if (tgetent(NULL, getenv("TERM")) != 1) {
> +       nr_term_colors = 0;
> +       return;
> +   }
> +   nr_term_colors = tgetnum("Co");
> 
> I would write the above as:
> 
>      if (tgetent(NULL, getenv("TERM")) == 1)
>          nr_term_colors = tgetnum("Co");
>      else
>          nr_term_colors = 0;

The has_colors() was a bug, it was suppose to set colors to zero and then 
return. But I didn't realize has_colors() always returns zero until ncurses has 
been initialized. The tgetent() return avoids the conditional block at bottom.

New patches attached.

Attachment: 0001-get-number-of-terminal-colors.patch
Description: Text Data

Attachment: 0002-bold-attribute-and-bright-prefix-change.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]