Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: End boldface also ends background color



On Wed, 23 Mar 2016 18:53:56 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> There's no TCBOLDFACEEND, which I presume is why %b resorts to turning
> off everything.  But I don't know much about how the txt* macros work.

The bottom level of this, where it feeds into termcap, is
settextattributes() in zle_referesh.c:

    if (txtchangeisset(atr, TXTNOBOLDFACE))
	tsetcap(TCALLATTRSOFF, 0);

Even in terminfo there doesn't seem to be exit_bold_mode, unlike
standout, reverse and underline (though it looks like standout maps to
reverse here).

If you look at the definitions, you'll see that \e[1m turns on bold,
\e[7m reverse, \e[4m underline.  The definitions mapping to exit reverse
and exit underline are \e[27m and \e[24m.  Nothing maps to \e[21m that I
can see.  It works on some terminals, I used gnome-terminal:

print -P "first%Ufoo%{\e[1m%}bar%{\e[21m%}more%ulast"

However, that didn't seem to work on xterm (a few years old), so
apparently we can't assume it.  We could make it an option, but that's a
bit of a pain.  Short of that, it's not going to work without rewriting
the code substantially to track the current mode as well as the modes
that need changing.

> The doc for %F references zle_highlight which implies that you should
> be able to do %F{bold} but that doesn't work, and the numeric color
> values supported are not the ANSI color attributes.  The doc should
> probably be tightened up to reflect this.

No, they're not the same thing, though we do make use of termcap for
colours where available.

pws



Messages sorted by: Reverse Date, Date, Thread, Author