Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Length of %? in prompt
- X-seq: zsh-users 4717
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Ian Lynagh <igloo@xxxxxxxx>
- Subject: Re: Length of %? in prompt
- Date: Thu, 28 Feb 2002 08:45:03 -0800 (PST)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20020228153400.GA31674@xxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Sender: schaefer@xxxxxxxxxxxxxxxx
On Thu, 28 Feb 2002, Ian Lynagh wrote:
> I have just a couple more problems. Firstly I can't find a way to have
> ANSI escape sequences actually executed when they are passed through
> psvar - is this possible?
No, it's not possible. The contents of psvar are always passed through
zsh's internal "nice display" filter, which works sort of like "cat -v".
> And secondly with
> "%\$((\$COLUMNS-2))>%{%}k>"
> the %{%} appear in the prompt
In %N>STRING> the STRING is not re-interpreted for prompt escapes, but it
is not "nice-filtered" either. Which also explains this:
> and both
> "%\$((\$COLUMNS-2))>${(%%):-%{$fg_bold[cyan]%\}}k>"
> and "%\$((\$COLUMNS-2))>\${(%%):-%{$fg_bold[cyan]%\}}k>"
> seem to be counting the length of the ANSI escape sequence in the length
> calculation - am I missing something?
However, it's not making any sense to me that you want to insert a color
change only when the string is truncated. I think you're probably seeking
something like this:
PS1='%$((COLUMNS/2))> >blah blah blah %<<%{$fg_bold[cyan]%}'
where "blah blah blah" is the variable-width stuff you want truncated.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author