zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: zsh-workers@zsh.org, Oliver Kiddle <opk@zsh.org>, dana <dana@dana.is>
Subject: Re: [PATCH] prompt: support generic non-visible regions
Date: Thu, 11 Aug 2022 16:37:08 +0200	[thread overview]
Message-ID: <CAN=4vMqHNZJ7BvCCNbD7-0nPr1CbN1ecHQVxSsaZQ1Ao13__jg@mail.gmail.com> (raw)
In-Reply-To: <20220810115120.182853-1-felipe.contreras@gmail.com>

On Wed, Aug 10, 2022 at 1:56 PM Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>
> readline assumes anything between \001 (start of header) and \002 (start
> of text) is non-visible characters.
>
> In zsh we do this with `%F{color}`, but we could support
> `\001\e[31m\002` as well.

I like this patch but for a different reason. It closes the capability
gap in zsh prompts with and without prompt_percent.

When one disables prompt_percent, they can do all the same things as
before _except_ mark some sequences as zero-width. The loss of this
capability in turn means that one cannot use colors (and many other
things) in prompt without prompt_percent.

With this patch we'll have a nice guarantee that the following two
pieces of code are equivalent:

A:

    emulate -R zsh
    PS1=$whatever

B:

    emulate -R zsh -o no_prompt_percent
    PS1=${(%)whatever}

(Assuming no other prompt parameters are set.)

No real-world use cases come to mind but it just looks simple and
elegant from the user's point of view.

Roman.


  parent reply	other threads:[~2022-08-11 14:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 11:51 Felipe Contreras
2022-08-10 18:59 ` Mikael Magnusson
2022-08-10 19:56   ` Felipe Contreras
2022-08-11 14:02     ` Mikael Magnusson
2022-08-11 14:26       ` Felipe Contreras
2022-08-11 18:32         ` Mikael Magnusson
2022-08-11 18:47           ` Felipe Contreras
2022-08-11 18:54             ` Mikael Magnusson
2022-08-11 19:46               ` Felipe Contreras
2022-08-11 20:38                 ` Bart Schaefer
2022-08-11 23:22                   ` Felipe Contreras
2022-08-11 14:37 ` Roman Perepelitsa [this message]
2022-08-11 15:21   ` Bart Schaefer
2022-08-11 16:20     ` Felipe Contreras
2022-08-11 16:49       ` Bart Schaefer
2022-08-11 18:48         ` Felipe Contreras
2022-08-11 17:24   ` Roman Perepelitsa
2022-08-11 18:55     ` Roman Perepelitsa
2022-08-11 19:23     ` Felipe Contreras
2022-08-11 19:35       ` Roman Perepelitsa
2022-08-11 19:44         ` Felipe Contreras

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='CAN=4vMqHNZJ7BvCCNbD7-0nPr1CbN1ecHQVxSsaZQ1Ao13__jg@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=dana@dana.is \
    --cc=felipe.contreras@gmail.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).