bug-ncurses
[Top][All Lists]
Advanced

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

Re: Question about setal in terminfo db


From: Robert Lange
Subject: Re: Question about setal in terminfo db
Date: Sat, 19 Mar 2022 17:11:37 -0400

On Sat, Mar 19, 2022 at 04:10:09PM -0400, Thomas Dickey wrote:
On Sat, Mar 19, 2022 at 01:05:04PM -0400, Robert Lange via Bug reports for 
ncurses, the GNU implementation of curses wrote:
I have a concern about the terminfo definition for setal, particularly for 
tmux, but also in the other places it appears.

The definition I'm looking at in tmux-direct is:

setal=\E[%?%p1%{8}%<%t5%p1%d%e58:2::%p1%{65536}%/%d:%p1
      %{256}%/%{255}%&%d:%p1%{255}%&%d%;m

This is clearly patterned after the setaf and setab definitions for direct 
addressed color, in which the parameter value less than 8 generates something 
like '\E[31m' and anything greater than 8 generates an RGB value. However, for 
setal, I don't think this makes sense, as SGR 50-57 don't refer to the primary 
terminal colors, but to other (generally unimplemented) terminal features.

I *think* the definition for setal should be simply:

setal=\E[58:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1
      %{255}%&%dm

I've tested this on tmux 3.2a and it works.  When I pass in a parameter less
than 8, the underline color becomes the corresponding primary terminal color,
so I assume that the underlying terminal (libvte 0.54.2 in my case) has some
built-in logic to handle colors #000000-#000007 specially.  Specifying colors

I recall some comment about that, but since there's no documentation for VTE
aside from its source-code, that's an unimportant implementation detail.

git says the feature was added in 0.51.2 (December 2017).

Its developers decided to refer to this as "deco" (apparently to use
the same number of characters as "fore" (foreground) and "back" (background).

greater than or equal to 8 work exactly as expected, using the RGB value.
(I've also double-checked this using a libvte 0.54.2-based terminal without
tmux, with the same results.)

I don't have a copy of mintty handy, so I can't yet verify how that handles
setal, but I'd be surprised if '\E[51m' is the correct code for red
underline, given that their own documentation says it's supposed to be an
emoji style selector.

hmm - mintty doesn't have a terminfo file in its sources.
Reading the source-code... there's nothing that would handle 50-57 specially,
and I don't see any commits in the git which would do that.

I got the info about emoji style selectors from:

https://github.com/mintty/mintty/wiki/Tips#text-attributes-and-rendering

But if there's nothing in the source about that, then I guess it's
just a planned feature...

commit ee62f9006b4a14b5f71bf450e235fe63f3fba210
Author: mintty <mintty@users.noreply.github.com>
Date:   Tue Apr 17 23:31:26 2018 +0200

   SGR 58/59 text attributes for underline colour

(about 6 months after the corresponding changes in VTE).

agreeing, that's an error here:
# 2019-06-08
#       + add mintty, mintty-direct (Thomas Wolff)

tmux-direct came from here:

https://github.com/tmux/tmux/issues/2370

and while Nicholas commented that (this detail) was incorrect,

https://github.com/tmux/tmux/issues/2370#issuecomment-688158151

neither he nor I noticed that the updated patch did not fix it.

(That leads me to another point, which is that vte (at least 0.54.2 and
later) supports setal, so I'd like to add that to vte-256color and
vte-direct, but we can handle that in a separate thread if preferable.)

it seems simple enough - I'm only working on terminfo today, will add/amend

One other feature that I noticed that vte supported that was missing
in the terminfo entry was 'blink=\E[5m'. Not sure if there's a reason
that got left out (a lot of hate for blink in some quarters) or if it
just got missed b/c vte doesn't really document their terminal.

--
Rob Lange



reply via email to

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