zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Feature request: italic style in region_highlight
Date: Wed, 26 May 2021 00:43:57 +0200	[thread overview]
Message-ID: <59630-1621982637.439991@gOpL.wWUN.wfpJ> (raw)
In-Reply-To: <CAH+w=7ZnSy5RpXruh5hPit174RTv-ZSHaKyFaoK5fSkmKOCP2A@mail.gmail.com>

Bart Schaefer wrote:
> On Fri, Jan 3, 2020 at 1:05 PM Daniel Shahaf <d.s@daniel.shahaf.name> 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
benefit.

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

Oliver


      reply	other threads:[~2021-05-25 22:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30  1:29 Sebastian Gniazdowski
2019-12-30 10:16 ` Roman Perepelitsa
2019-12-30 16:07   ` Bart Schaefer
2019-12-30 16:26     ` Roman Perepelitsa
2020-01-01  0:07       ` Bart Schaefer
2020-01-02 19:18         ` Oliver Kiddle
2020-01-02 19:45           ` Roman Perepelitsa
2020-01-03  2:30             ` Bart Schaefer
2020-01-03 20:28               ` Daniel Shahaf
2021-05-20 13:33                 ` Marlon Richert
2021-05-25 16:38                   ` Oliver Kiddle
2021-05-25 20:50                     ` Marlon Richert
2021-05-25 20:56                       ` Bart Schaefer
2021-05-27  8:04                         ` Marlon Richert
2021-05-25 17:28                 ` Bart Schaefer
2021-05-25 22:43                   ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59630-1621982637.439991@gOpL.wWUN.wfpJ \
    --to=opk@zsh.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).