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

Re: Feature request: italic style in region_highlight

Bart Schaefer wrote:
> On Fri, Jan 3, 2020 at 1:05 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Why would we create either %A{4} or %A{04}?  The API to script writers should
> > use symbolic names; the API between us and the terminal should use terminfo
> > rather than hardcoded escape sequences.
> We've already found in another thread (the one about %B/%b) that
> terminfo is inadequate, it doesn't define escapes for all possible
> ANSI combinations.  In this specific example, %A{bold} has no terminfo
> equivalent to turn (only) it off when %a is reached.

Inadequacies of terminfo is even more reason to only expose symbolic
names to users/script writers.

We're tracking the state of all attributes and something like

  print -P '%B%U hello %b bye %u'

Turns off all attributes and then turns underline back on when it
reaches the %b.

Whether we want to hardcode a raw escape (such as for turning off bold)
comes down to how portable it is and whether it brings us any actual

There are times where the remembering of attribute state is actually a
nuisance. In my own .zshrc, in a loop where I build up associative
arrays to represent attributes/colours in different formats, I need the
following to reset it:

  : ${(%):-%u%b%k%f}

What isn't so clear is how the %A{ interface should handle turning
attributes off, either:

   %A{italic} ... %a{italic}  is needed
   %A{italic} ... %a          where we remember what the last %A was
   %A{italic} ... %a          where %a turns off all attributes
   %A{italic} ... %A{-italic}

Those options aren't all necessarily exclusive.
Also, what about allowing %A{bold,italic} or even %A{fg=208} ?


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