zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Turning display attributes on / off in prompt strings
Date: Sat, 17 Dec 2022 01:43:53 +0100	[thread overview]
Message-ID: <37998-1671237833.378022@KQt2.DuNm.SJtt> (raw)
In-Reply-To: <CAH+w=7Yt757b8erwTo5Y1+1fBSQbShV6XCaM8q6wnkGZHmQqeA@mail.gmail.com>

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


  reply	other threads:[~2022-12-17  0:44 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 [this message]
2022-12-17  7:50   ` Bart Schaefer
2022-12-17  9:47     ` Oliver Kiddle
2022-12-17 19:45       ` Bart Schaefer
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=37998-1671237833.378022@KQt2.DuNm.SJtt \
    --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).