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

Re: Turning display attributes on / off in prompt strings



Bart Schaefer wrote:
> So the problem from the original thread (workers/48800 and refs) is
> that you can't mix in "raw" sequences for attributes that prompt.c
> doesn't "know about" lest those attributes become disabled every time
> %s, %u, or definitely %b on any terminal, is used.

It can also get confused when you assign the results of ${(%)...} to a
variable without printing the results. My .zshrc contains instances of
  : ${(%):-%u%k}

> > 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.
> [...]
> > 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?

I'd be reluctant to create an extra setopt without first having evidence
that terminals that need it are still in use. And if we need a way to
override terminal settings, something more generic may be better. I like
tmux's terminal-overrides[] but that's tied to terminfo and the premise
of this problem is that there is no termcap/info entry for end of bold.
Maybe #ifdef around it and add a configure option that we can remove
later.

> In connection with Oliver's patch to eat CSI sequences ... perhaps we
> should abandon looking up termcap strings for these attributes, or at
> least have a fallback to the ANSI set when we encounter a termcap
> result that's not specific enough?

If we allow ourselves more assumptions about escape sequences, we could
also make zsh an easier experience for new users by binding a few more
keys by default. There even is termcap entries for some. For a very long
time, I've taken the approach of binding nearly all sequences for every
terminal I use rather than using case $TERM and the superfluous bindings
are harmless.

Oliver




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