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

Re: End boldface also ends background color



On Thu, Mar 24, 2016 at 11:38 AM, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> 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.

Like I wrote in my first reply, 22 turns off bold in most terminals,
but termcap doesn't include it.
ctlseqs.txt says
            Ps = 2 2  -> Normal (neither bold nor faint)
            Ps = 2 4  -> Not underlined
            Ps = 2 5  -> Steady (not blinking)
            Ps = 2 7  -> Positive (not inverse)
            Ps = 2 8  -> Visible, i.e., not hidden (VT300)
and as you say, nothing maps to 21. I don't know why termcap doesn't
include the bold-off code.

>> 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



-- 
Mikael Magnusson



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