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

Re: Suggested improvement for sticky-note



On 5/9/21, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Just now getting back to this ...
>
[...]
> Finally, you've embedded the definition-time theme color in the note
> at the point where blink is turned off, so if the theme changes (new
> zstyle applied) any notes that had color changes or blink will revert
> to the previous theme's coloring.  In fact this makes me aware that it
> doesn't really work to interpret prompt escapes, because (for example)
> after %Bbold%b the background color reverts as well and the rest of
> the note is no longer yellow.
>
> It's going to take a bit more thought to decide what it's possible to
> salvage from this, so no patch yet.
>
> For any other zsh-workers reading this:  Does anyone know why
> putpromptchar() has this?
>             case 'b':
>                 txtchangeset(txtchangep, TXTNOBOLDFACE, TXTBOLDFACE);
>                 txtunset(TXTBOLDFACE);
>                 tsetcap(TCALLATTRSOFF, TSC_PROMPT|TSC_DIRTY);
>                 break;
> That is, why TCALLATTRSOFF ?  That isn't done for %s or %u ... why is
> there no TCBOLDFACEEND defined?

I think that's a shortcoming in termcap and/or terminfo. In termcap
there is md (1m) and me (0m) that should correspond to bold, but 0m
turns off all attributes. Compare with us (4m) and ue (24m).
https://www.gnu.org/software/termutils/manual/termcap-1.3/html_chapter/termcap_4.html
also implies that there is no specific termcap sequence to only turn
off specific appearance modes.

When it comes to ANSI sequences though, there definitely are. From ctlseqs.txt,

            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)

Since we already assume ANSI for things like colors, I don't think we
would lose a lot of compatibility in practice if we just use 22
instead of 0 for %b, but we could potentially put it behind a setopt?

-- 
Mikael Magnusson




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