zsh-workers
 help / color / mirror / Atom feed
* [regression] %2K prompt expansion no longer works
@ 2020-08-30 11:13 Stephane Chazelas
  2020-08-30 13:17 ` Mikael Magnusson
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2020-08-30 11:13 UTC (permalink / raw)
  To: Zsh hackers list

$ 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;
 }
 
Cheers,
Stephane


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [regression] %2K prompt expansion no longer works
  2020-08-30 11:13 [regression] %2K prompt expansion no longer works Stephane Chazelas
@ 2020-08-30 13:17 ` Mikael Magnusson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2020-08-30 13:17 UTC (permalink / raw)
  To: Zsh hackers list

On 8/30/20, Stephane Chazelas <stephane@chazelas.org> 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.

I likely only tested %K{2}, sorry about that (looks like not many
other people use %2K either though).

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-30 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30 11:13 [regression] %2K prompt expansion no longer works Stephane Chazelas
2020-08-30 13:17 ` Mikael Magnusson

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git