Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Support true colours via termcap interface
- X-seq: zsh-workers 44039
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Support true colours via termcap interface
- Date: Mon, 4 Feb 2019 09:11:04 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=X1cdaIRVVVFS/91yzakTfqBnzJBWtGY6j26bWJ84c3I=; b=m0vSXbmI2oljH4wzcQiedxpvRkyXnaVUMeiu0XeLkUx+bPddHuFK2Lg4+s2p3ZDNv9 HjFRihdXEpWnE2v5lIRtzd6OHW1hccjmhvF1TVo8qAY3zr2w/2M3w7AWxBsK0unZxGjL 2txKx6hoP85KRfEeJ+kBZt+i+nbnImqSZ9/V0u4vN/gtGeoKCAwt2bTDPRaY0AOAkPZL jkV/EYx9q2/tQWlIvjo2dinFWZppdcocQhtx7ek9yTNilzdwksqAL9ZUrtJwVs8vqNM9 0L1WI8Kf6RQWm6XvaGNshCbz3cVk1QKwfBC1Js1OBaROdZVdvHduh16yTju/s+SYMJN1 J/fA==
- In-reply-to: <20190204061946.dmygdd7n5c2zoi7d@Daniels-MacBook-Air.local>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20190203215711.sofrde7s4lb7nttb@Daniels-MacBook-Air.local> <CAKc7PVAU=zGtb09CofABLargxmYmgMaD-GmfTuYB1OVp=SuzRA@mail.gmail.com> <20190204061946.dmygdd7n5c2zoi7d@Daniels-MacBook-Air.local>
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