[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wrong foreground colors with TERM=linux-16color using ncurses
From: |
Thomas Dickey |
Subject: |
Re: Wrong foreground colors with TERM=linux-16color using ncurses |
Date: |
Sat, 26 Oct 2019 11:57:37 -0400 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Fri, Oct 25, 2019 at 09:30:55PM +0200, Dino Petrucci wrote:
> There is a problem with colors in the Linux console by defining
> TERM="linux-16color" with the actual terminfo database (rev. 1.742).
> Vim, GNU Emacs, and other programs that use ncurses with foreground
> colors from 0 to 7 display just one color. Attachments show three cases
> (I ran 'M-x list-colors-display' within 'emacs -q'):
>
> linux.png [all right]
> $ export TERM="linux"
>
> linux16_21.png [wrong]
> $ export TERM="linux-16color"
>
> The problem could be solved by changing the string definition (see
> 'terminfo.src' rev. 1.742 at line 1134) from
>
> setaf=\E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m
>
> to
>
> setaf=\E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;22%;m
hmm - I recall some change in the Linux source-code which amended this case.
man console_codes helps:
21 set normal intensity (ECMA-48 says "doubly underlined")
22 set normal intensity
and looking at current code
https://github.com/torvalds/linux/blob/f877bee5ea0b56c39cd0a243e113a577b5a4ef92/drivers/tty/vt/vt.c#L1693
versus a year or so ago
https://github.com/torvalds/linux/blob/f1869a890cdedb92a3fab969db5d0fd982850273/drivers/tty/vt/vt.c#L1392
shows that the change was made. The commit comments are useless since
none mentions this change.
https://github.com/torvalds/linux/commits/master/drivers/tty/vt/vt.c
(and it's unlikely that anyone updated the console_codes manpage).
Thanks for the note - I'll fill in the details.
> that is by replacing 21 with 22 in the 'else' statement. See the third
> attachment which shows the correct result, after compiling the database
> with the string 'setaf' changed:
>
> linux16_22.png [correct]
> $ export TERM="linux-16color"
>
> 'man 4 console_codes', section 'ECMA-48 Set Graphics Rendition', reports
> that parameter 21 'set normal intensity (ECMA-48 says "doubly
> underlined")'; I think ncurses considers 21 as "doubly underlined"
> somewhere. Instead the parameter 22 gives the correct result without
> any ambiguity.
The description's fairly old, and worked fine with Linux for ~20 years.
iirc, I wrote the comment in the console_codes manpage.
--
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature