1

I'm running Zsh 5.2 on MacOS, running in Terminal.app with TERM set to xterm-256color.

When styling the PROMPT, I found that in this Zsh version, a %b cancels the effect of a previous %K. Consider this example:

print -P '12%K{green}34%B56%b78%k90'

This prints only 3456 with green background, not 345678, as I would have expected.

If I replace the %B...%b by %U...%u or %S...%s, 345678 receives the green background. It seems that only %b is implicitly cancelling the effect of %K.

Can somebody explain, why this is so?

1
  • Maybe this is a bug in zsh 5.2 or xterm-256color. Using zsh 5.7.1-dev on Linux with rxvt-unicode or xterm I get the expected result. Can you narrow this down by trying another terminal emulator or a newer zsh version?
    – mpy
    Commented Apr 24, 2019 at 15:55

1 Answer 1

1

This is a bug in zsh 5.2. It was fixed with this commit

commit e87aa8941fd7e13b039bf4d1664c6dc39a09313a
Author: Oliver Kiddle <[email protected]>
Date:   Fri Jul 8 22:28:15 2016 +0200

    38809: fix tracking of colour attributes and restore them when turning bold off

which was incorporated into zsh 5.3.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .