Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ETA for zsh 5.7? (was: Test release: 5.6.2-test-3)
- X-seq: zsh-workers 44006
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: ETA for zsh 5.7? (was: Test release: 5.6.2-test-3)
- Date: Mon, 21 Jan 2019 22:56:23 +0100
- Cc: Peter Stephenson <p.stephenson@xxxxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- 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 :cc; bh=i//W4KVjtTQeLX2sXMIdfHlqjiVULthPvZM3hsn/hfg=; b=WG8g4+g9Ut9gt5cRR3KpP+E0ORqFw7wFslMgUGiguPye/1WAwd/hAMIZR45y8GRaym wZfPjk0BazOb4sxoP6AnZsDIZ6vc506S1gu+35Il6EjZwHMZ7KGv0tiYWaoVMYn9qyOA Jy26aOsw8o310DFGuSWzJz7QnVDPjzrj/lhPJ7XZ9g1oZffaUGpq2Ur5XznOLXst7v17 N0Pf4VLaCMuh/lX7t81FMXIbq4KDtwDEocNwyigCK2m09N8O4d9Ya5nuDERRY9ZJO0dH xNujdwwvyNkd2KuuIpRtMfMdl60LOXESpFQJSuFj7RDKa4VdJHfa1IVV8c2qsywPTOL9 u8xg==
- In-reply-to: <CAHYJk3Q3h8GpuAEf3GUxRHXn0cnOTkewocty=2Lb+SNSEPF+gA@mail.gmail.com>
- 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: <C0CF1A8E-FD75-4024-BA4B-0C4D8880FB8D@dana.is> <CGME20190121130507epcas3p3e33e3b2a40afe34f8b1701103f81e31c@epcas3p3.samsung.com> <20190121125412.GE18595@sym.noone.org> <1548080801.4661.0.camel@samsung.com> <CAHYJk3Sa9oLZrnFztHxezLtc-4n71UZNDURgV9kRfZJwRy_Lrw@mail.gmail.com> <CAHYJk3Q3h8GpuAEf3GUxRHXn0cnOTkewocty=2Lb+SNSEPF+gA@mail.gmail.com>
On Mon, 21 Jan 2019 at 20:32, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> With the commit applied,
> % print -P %F{10}hello|cat -v
> ^[[38;5;8;5;10mhello
Following debugs shows that:
1. For color > 7, a termcap-route was being used, ignoring the fg_start_code
2. For color <= 7, the same termap-route was being used ignoring the
fg_start_code.
3. The fg_start_code-route is used only for colors <= 7 in some
other circumstances (I'm occuring this normally for an
region_highlight--&-colors<=7-utilizing code.)
http://sprunge.us/GcRDpx
(also attached as debug.txt)
So basically, Mikachu has following setting:
zle_highlight=( fg_start_code:$'\e[38;5;' )
It's always using termcap for color >= 8,, because of this line ~1983
in prompt.c::
if (!def && (colour > 7 || use_termcap)) {
But also, the `use_termcap' is apparently always being set if colur > 7.
But the new code, NEVER IGNORES fg_start_code if it's different from
the default «\e[». So the code starts to finally use the fg_start_code
and problems appear. The problems come from the fact that: the are
additional fields needed in zle_highlight, to make it fully usable.
With the new code it IS usable as it is basically USED after all when
set, so e.g. a debugging code (the X04 tests) can use the
zle_highlight mechanism reliably.
> Blindly appending 8;5; to my custom start code seems extremely
> broken and I have no idea under what circumstances it would ever be
> correct to do so. In fact it directly contradicts the documentation:
>
> fg_start_code (\e[3)
> The start of the escape sequence for the foreground colour. This
> is followed by an ASCII digit representing the colour.
>
> 8;5; is clearly not an ASCII digit.
Ok, but the documentation also misses the fact that in the OLD code,
for col > 7 termcap is used anyway, and also the same for col <= 7, if
the color is invoked in `print -P %F{5}' and possibly other situations
(but not always, region_highlight utilizing the first 8 colors does
use fg_start_code also in the old code).
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Doing: print -P %F{10}hello | cat -v
The debug logs (code at the bottom):
Yes, using termcap, color:10 / tccolors:256 / use_termcap:268435456
Yes, using termcap, color:10 / tccolors:256 / use_termcap:268435456
NOT, using termcap, 7 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
Yes, using termcap, 63 / 256 / 268435456
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
NOT, using termcap, 7 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
Yes, using termcap, 63 / 256 / 268435456
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
Doing: print -P %F{5}hello | cat -v
Yes, using termcap, 5 / 256 / 268435456
Yes, using termcap, 5 / 256 / 268435456
NOT, using termcap, 7 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
Yes, using termcap, 63 / 256 / 268435456
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
NOT, using termcap, 7 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
Yes, using termcap, 63 / 256 / 268435456
NOT, using termcap, 0 / 256 / 0
Appended [^[[38;5;] to the colseq_buf[^[[38;5;]
diff --git a/Src/prompt.c b/Src/prompt.c
index 959ed8e3d..1941b8ec9 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -1987,6 +1987,14 @@ set_colour_attribute(int atr, int fg_bg, int flags)
*/
if (tccan(tc) && (tccolours < 0 || colour < tccolours))
{
+
+ FILE *f = fopen("/tmp/reply", "a+");
+ if ( f ) {
+ fprintf(f, "Yes, using termcap, color:%d / tccolours:%d / use_termcap:%d\n", colour, tccolours, use_termcap);
+ fflush(f);
+ fclose(f);
+ }
+
if (is_prompt)
{
if (!bv->dontcount) {
@@ -2010,6 +2018,13 @@ set_colour_attribute(int atr, int fg_bg, int flags)
*/
if (colour > 7)
return;
+ } else {
+ FILE *f = fopen("/tmp/reply", "a+");
+ if ( f ) {
+ fprintf(f, "NOT, using termcap, %d / %d / %d\n", colour, tccolours, use_termcap);
+ fflush(f);
+ fclose(f);
+ }
}
if ((do_free = (colseq_buf == NULL))) {
@@ -2019,6 +2034,11 @@ set_colour_attribute(int atr, int fg_bg, int flags)
strcpy(colseq_buf, fg_bg_sequences[fg_bg].start);
+ FILE *f = fopen("/tmp/reply", "a+");
+ fprintf(f, "Appended [%s] to the colseq_buf[%s]\n", fg_bg_sequences[fg_bg].start, colseq_buf);
+ fflush(f);
+ fclose(f);
+
ptr = colseq_buf + strlen(colseq_buf);
if (def) {
strcpy(ptr, fg_bg_sequences[fg_bg].def);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author