Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Small zle_highlight regression in 5.7
- X-seq: zsh-workers 44030
- From: dana <dana@xxxxxxx>
- To: Jan Larres <jan@xxxxxxxxxxxxxx>
- Subject: Re: Small zle_highlight regression in 5.7
- Date: Thu, 31 Jan 2019 19:46:33 -0600
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qc5FHCbs2XoWaUr2DPF4Iw9YwBAM+7mCY6UsYzFnBcU=; b=hDrFHie9/7bqZfE3faJ+SZiIsa/qs0y+hBRN7eIhWil1qPsgJNhu1aEk2lgMJAs7xB W3NmUyWqZyX30UpewZgmEg3m2EUxNrwfiV7AFW2ZAkqBxTd7Zv34y83MGk8zhF/QH2fM p0IZR9aE5lfsFOJdAcOiYjbOgeAG4aBRMJUyZKSGGualpGz4ui/BSFi114VoBhYPcQix t1fRcnQOO874OHc3BRiOhLJFFc4fQW9g5tEg6Oqp1OTvfPlGzB0DqbN9id4OgDaxYnSn OWxZ/L3c7zlHa7Gmd1I60PjYHLNKEn0a3P0EqIbeAYo6STIkluMwBFql/POwQLNZY1jx 3ttw==
- In-reply-to: <6e542e69-1e09-1af7-0c68-8af456dd043e@majutsushi.net>
- 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: <6e542e69-1e09-1af7-0c68-8af456dd043e@majutsushi.net>
On 31 Jan 2019, at 17:31, Jan Larres <jan@xxxxxxxxxxxxxx> wrote:
>In 5.6.2 I was able to use the special 'reset' foreground attribute ...
>This doesn't work any more in 5.7: ...
>I also can't find any mention of this attribute in the documentation any more.
I don't think it was ever there — the documented way to do this is %F{default}
or simply %f. %F{reset} only worked because unrecognised colour names would
just fall back to the default sequence (which doesn't seem to be mentioned
explicitly anywhere?).
5.7 did change that, though, and i'm not sure it was intended.
This seems to fix it
dana
diff --git a/Src/prompt.c b/Src/prompt.c
index 4603ffba6..f2b3f161e 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -1661,10 +1661,12 @@ match_colour(const char **teststrp, int is_fg, int colour)
colour = match_named_colour(teststrp);
if (colour == 8) {
/* default */
return is_fg ? TXTNOFGCOLOUR : TXTNOBGCOLOUR;
}
+ if (colour < 0)
+ return TXT_ERROR;
}
else {
colour = (int)zstrtol(*teststrp, (char **)teststrp, 10);
if (colour < 0 || colour >= 256)
return TXT_ERROR;
diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst
index 56b7c294a..7ff478e68 100644
--- a/Test/D01prompt.ztst
+++ b/Test/D01prompt.ztst
@@ -221,3 +221,11 @@
print ${(%U)Y-%(v}
0:Regression test for test on empty psvar
>
+
+# Unrecognised colour strings should produce the default sequence
+ f=${(%):-'%f'} # Recognised
+ Fdefault=${(%):-'%F{default}'} # Recognised
+ Freset=${(%):-'%F{reset}'} # Unrecognised
+ Ffoo=${(%):-'%F{foo}'} # Unrecognised
+ [[ $f == $Fdefault && $Fdefault == $Freset && $Freset == $Ffoo ]]
+0:Regression test for workers/44029
Messages sorted by:
Reverse Date,
Date,
Thread,
Author