Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] prompt: support generic non-visible regions
- X-seq: zsh-workers 50454
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- Cc: zsh-workers@xxxxxxx, Oliver Kiddle <opk@xxxxxxx>, dana <dana@xxxxxxx>
- Subject: Re: [PATCH] prompt: support generic non-visible regions
- Date: Thu, 11 Aug 2022 16:37:08 +0200
- Archived-at: <https://zsh.org/workers/50454>
- In-reply-to: <20220810115120.182853-1-felipe.contreras@gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20220810115120.182853-1-felipe.contreras@gmail.com>
On Wed, Aug 10, 2022 at 1:56 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author