Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [regression] %2K prompt expansion no longer works
- X-seq: zsh-workers 47499
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: [regression] %2K prompt expansion no longer works
- Date: Sun, 25 Oct 2020 20:12:19 +0000
- Archived-at: <https://zsh.org/workers/47499>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-10/20201025201219.24ef0ddc%40tarpaulin.shahaf.local2>
- Authentication-results: zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; s=fm1; bh=fnyEKlSDQLtBFxozGQMk0Kkfua tcv3B3fItTKEkuTSI=; b=jcoUwuWLbiKPrLxAU12IG6dEAwyDxTjwsc1a6Bu8UM yUNa0c4ngw92uLcKSAU5OqdE9bS2TKff4muuvfA0McIneuvO6ovpUSTt9O7gyOKH 0Iuj32nMrWLCrLrxo0aKq8JsiMJKuNUrOtrxKO1ZqOigILYlrhUjp4mIPAg49ltI yvqzmPVsdo/Wam4cPkaS5cEC4WyeBno56bv2Yo2JDmA8SQUv/BgiT3hCXMnmmz4x +dybNPs/Rzs6RxEbVNdV5KnqGalmMv+ECSvRP/MKiX3OUShxo4z1QmnYm2DSkmFU ibMZioHvUCUiroAmWW9yYkjYvMTQap0rW+6o653/bhGw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=fnyEKlSDQLtBFxozGQMk0Kkfuatcv3B3fItTKEkuT SI=; b=TJAGHYi7d6rTgmEZEz+6OQsQZycHm46XqmPaYmEBszNSfqlVLlUigQH44 4hdL0RxOJYupgUbeWE7EYeJk6Sy/iV1FclXfhZ5GoETmOlva6nw0cKYLV9vhXxRL k+v0veNBY9SVs36khP/jsu0v8lWJR+myvY5Yj/SClLxKSLbrSlPN+19Aipsz9ly2 yGwj+oJmqwvC273qaMgO/bvwN4voY++x4XyQPLWbiQyCPp/JNcqBTfbvonCfiXqv Xm9c8Hi+yTSxKHvKLlq/O7KAM73/ZtnRIAMvIGMCwFnuhUwtVb00TRfEcNvJn3UF vsVmIiC92SHRkA6XMWUNp9TE1MX2g==
- In-reply-to: <CAHYJk3SPBJvnEhWDDifxRXw3t89p1XbJ08w1QZb_kQVWrRVK5Q@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <20200830111346.xulnbxoqxduetnoz@chazelas.org> <CAHYJk3SPBJvnEhWDDifxRXw3t89p1XbJ08w1QZb_kQVWrRVK5Q@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
Mikael Magnusson wrote on Sat, 24 Oct 2020 16:21 +0200:
> On 8/30/20, Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> > $ print -rnP %2K | hd
> > 00000000 1b 5b 34 30 6d |.[40m|
> > 00000005
> >
> > %K{2} is fine:
> >
> > $ print -rnP '%K{2}' | hd
> > 00000000 1b 5b 34 32 6d |.[42m|
> > 00000005
> >
> > Introduced by worker:30496
> > (https://www.zsh.org/mla/workers/2012/msg00421.html
> > 8a9b141652a0e4157056dc21e36a64ac712a7ee7 git commit).
> >
> > Oddly, the comment there:
> >
> >> Well, nobody objected so here's a version with de-duplicated
> >> code. The previous patch broke %K, but it works now (passed 1
> >> for is_fg on both paths).
> >
> > Actually describes the bug here. Looks like Mikael just missed a bit in
> > that
> > fix.
> >
> > Should be fixed with:
> >
> >
> > diff --git a/Src/prompt.c b/Src/prompt.c
> > index bc9734720..997327e18 100644
> > --- a/Src/prompt.c
> > +++ b/Src/prompt.c
> > @@ -258,7 +258,7 @@ parsecolorchar(zattr arg, int is_fg)
> > bv->fm--;
> > }
> > } else
> > - arg = match_colour(NULL, 1, arg);
> > + arg = match_colour(NULL, is_fg, arg);
> > return arg;
> > }
>
> Just noticed that these [unposted] testcases don't pass. Added some
> debugging prints and it turns out that %F{green} uses a different code
> than specifying the number. Eg,
>
> echo $F1 $F2 $F3 $F4 | cat -v
>
> results in
>
> ^[[38;5;2m ^[[38;5;2m ^[[38;5;2m ^[[32m
>
Isn't this what Oliver just pointed out in another thread? —
Oliver Kiddle wrote in 47491:
> Regarding (1), I just noticed that a new D01prompt test case is failing
> on FreeBSD because ${(%):-%F{2}} is not producing the same as
> ${(%):-%F{green}}. This is a new test added just last month in 47352.
>
> This is down to TXT_ATTR_FG_TERMCAP being set for 2 but not for green.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author