Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] prompt: support generic non-visible regions
- X-seq: zsh-workers 50458
- 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 19:24:47 +0200
- Archived-at: <https://zsh.org/workers/50458>
- In-reply-to: <CAN=4vMqHNZJ7BvCCNbD7-0nPr1CbN1ecHQVxSsaZQ1Ao13__jg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20220810115120.182853-1-felipe.contreras@gmail.com> <CAN=4vMqHNZJ7BvCCNbD7-0nPr1CbN1ecHQVxSsaZQ1Ao13__jg@mail.gmail.com>
On Thu, Aug 11, 2022 at 4:37 PM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> I like this patch [...]
I should've said that I like the idea behind it. The patch implements
one part of it. To complete the implementation percent expansion needs
to output \001 and \002.
> No real-world use cases come to mind [...]
Here's one. If this is implemented, it'll be possible to compute the
width of prompt in columns with ${(m)#${(%%)PS1}} (perform prompt
expansion and then ask for width). This is necessary in prompts that
look like this:
left------------------------right
bottom%
The first line spans the whole width of the terminal. One example of
such prompt is `prompt bart` from `promptinit`. This particular prompt
can compute the width of `left` and `righ` by utilizing the knowledge
of their content. If these pieces could be specified by the end-user,
the problem would be more difficult. I've described one (rather
cumbersome) solution here:
https://www.reddit.com/r/zsh/comments/cgbm24/multiline_prompt_the_missing_ingredient/.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author