zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Oliver Kiddle <opk@zsh.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Turning display attributes on / off in prompt strings
Date: Sat, 17 Dec 2022 11:45:40 -0800	[thread overview]
Message-ID: <CAH+w=7abhbe-+oXG75m-KK6UCrW6_PVFLmNK_jJu0LUD8Nt2Pw@mail.gmail.com> (raw)
In-Reply-To: <89232-1671270468.081657@opLX.-aX7.RvZU>

On Sat, Dec 17, 2022 at 1:47 AM Oliver Kiddle <opk@zsh.org> wrote:
>
> Bart Schaefer wrote:
> > the present prompt code would still emit the
> > then-unnecessary sequences to restore the other attributes.
>
> It's probably not worth replacing the escape sequence without also
> allowing it to avoid that because the original problem would only be
> partially solved.

Hm, I was thinking of it more as a new problem of optimization (we go
to some lengths in other places to send the shortest possible control
sequences).  In what way would the original problem not be solved?  An
attribute might be turned back on after having been turned off?

> We do already have an interface in the form of zle -T transformation func
> Transformation is currently only "tc" for termcap but something for end
> bold* or general attribute changing could be added. Prompt handling is in
> the main part of zsh rather than zle but the zle module could define a
> callback.

Hm, that's a bit more heavyweight than I was thinking, but would be
the most flexible.

I presume you mean to move the transformation to the main shell and
have zle call it?  Loading zle in non-interactive context would be
less desirable?

> * \e[22m selects normal, disabling also faint so naming indicating end
> of bold would be a poor choice.

That's true, outside of prompt context (which doesn't currently have a
way to express "faint" without using raw sequences).  But all the
other attributes are additive whereas faint/normal/bold are mutually
exclusive even at the terminal level, we're not going to be able to
make a general solution for (faint on)(bold on)(bold off) that ends in
(faint on) state.


  reply	other threads:[~2022-12-17 19:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 19:45 Bart Schaefer
2022-12-17  0:43 ` Oliver Kiddle
2022-12-17  7:50   ` Bart Schaefer
2022-12-17  9:47     ` Oliver Kiddle
2022-12-17 19:45       ` Bart Schaefer [this message]
2022-12-21 16:46         ` Oliver Kiddle
2022-12-21 21:28           ` Bart Schaefer
2022-12-21 17:12 ` Oliver Kiddle
2022-12-21 21:03   ` Bart Schaefer

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='CAH+w=7abhbe-+oXG75m-KK6UCrW6_PVFLmNK_jJu0LUD8Nt2Pw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=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).