Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Length of %? in prompt

On Thu, Feb 28, 2002 at 08:45:03AM -0800, Bart Schaefer wrote:
> 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".

OK, ta

> >     "%\$((\$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:

I missed the ^N out for simplicity, and in graphics mode k is a
top-right corner character. What I'm doing is something like this:

/--stuff--more stuff--some more stuff--------------------

and I am then truncating this to the screen width with \ (using / and \
for top-left and top-right corner characters respectively). The border
is in graphics mode and bold cyan while the various stuffs are in
various colours and normal text mode, so if it gets truncated in the
middle of them I am getting a text letter k in whatever colour happens
to be there. Therefore I want to set the colour and have a ^N in the
truncating string.

Any ideas?


Messages sorted by: Reverse Date, Date, Thread, Author