Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Support true colours via termcap interface



On Mon, 4 Feb 2019 at 07:20, Daniel Tameling <tamelingdaniel@xxxxxxxxx> wrote:
> > I.e. remove  or in other way lessen the use_truecolor condition.
> > Without this the true color output will be bypassing termcap.
>
> That is not necessary. use_truecolor is false and use_termcap is true,
> because TXT_ATTR_FG_24BIT isn't returned by match_colour but
> TXT_ATTR_FG_TERMCAP.
>
> Btw. I did that deliberately. I didn't want to make the if even more
> complicated and I wanted to use the same code path as for the
> %F{16763955} syntax. Making a small change to match_colour felt nicer
> than to hack around in set_colour_attribute.

Ahso,,ok, but I don't see the *_TERMCAP code being returned here,
could you explain?

> > -               return on | (is_fg ? TXT_ATTR_FG_24BIT : TXT_ATTR_BG_24BIT) |
> > -                       (zattr)colour << shft;
> > +                if (tccolours != 0x1000000 || colour < 8) {
> > +                        return on | (is_fg ? TXT_ATTR_FG_24BIT :
> > +                                     TXT_ATTR_BG_24BIT) | (zattr)colour << shft;
> > +                }

> >
> > Currently, the code  `print -P %F{16763955} ' DOESN'T work, so your
> > change does something that makes it working
>
> It doesn't work because match_colour currently returns TXT_ERROR for
> this sort of syntax if colour >= 256.

Ahso, ok.

> > , however the first code
> > example:
> >
> > print -P %F{'#ffcc33'} test
> >
> > Works with current code (ie. without the patch).
>
> Well, it works differently:
>
> Before the patch, the hardcoded escape sequence is used:
> $ TERM=xterm-direct print -P %F{'#ffcc00'} | cat -v
> ^[[38;2;255;204;0m
>
> Afterwards the terminfo entry is used:
> $ TERM=xterm-direct print -P %F{'#ffcc33'} | cat -v
> ^[[38:2::255:204:51m
>
> The former works because xterm understands both escape sequences, but

Ahso, OK. Let me just point the difference: the second code has two
clons after "38:2".

BTW., I recomend the following lecture (created by an iTerm hacker) to
know more about the termcap-codes deviations:

https://terminalguide.netlify.com/attr/fgcol256/
https://terminalguide.netlify.com/attr/fgdirectcolor/


That said: does the new X04 test pass with your patch?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



Messages sorted by: Reverse Date, Date, Thread, Author