From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Laurent Wacrenier <lwa@teaser.fr>
Cc: zsh-workers@sunsite.dk
Subject: Re: PATCH Re: infinite loop in prompt expansion
Date: Wed, 2 Oct 2002 07:18:02 +0000 [thread overview]
Message-ID: <1021002071803.ZM16600@candle.brasslantern.com> (raw)
In-Reply-To: <20021001093555.GA78178@victor.teaser.fr>
On Oct 1, 11:35am, Laurent Wacrenier wrote:
} Subject: Re: PATCH Re: infinite loop in prompt expansion
}
} Le Lun 30 sep 18:32:30 2002, Bart Schaefer écrit:
} > It shouldn't infinte loop, but I'd like to point out that it also is
} > not intended to do anything useful.
}
} This may have a sense within PS1 to set a xterm title or a terminal
} status line.
I guessed that was what you wanted, but it doesn't work.
Consider what happens when you put the %8<..< *outside* the %{ %} like so:
% print -P '%8<..<%{%/%}987654321'
../home/lwa654321
The manual says:
"The string within the braces should not change the cursor position."
Therefore zsh counts zero characters for everything from the %{ through
the matching %}, and applies the truncation to whatever comes after it.
Even when the %8<..< is put inside the braces, zsh is still counting zero
characters for everything through the ending %}. That's what confuses
the truncation code into going into an infinite loop.
} > Hence the fix (which is probably not going to make you happy) is this:
}
} Well... that's not what's wroten in the manual.
The manual says:
"The part of the prompt string to be truncated runs to the end of
the string, or to the end of the next enclosing group of the `%('
construct, or to the next truncation encountered at the same
grouping level (i.e. truncations inside a `%(' are separate), which
ever comes first."
Note that it *doesn't* say that it ends at the closing %} that matches a
preceding %{.
I think I've got a patch (by introducing Yet Another Global) that will
allow that to work, but I'd like to hear more zsh-workers' opinions first.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
prev parent reply other threads:[~2002-10-02 7:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-30 14:51 Laurent Wacrenier
2002-09-30 18:32 ` PATCH " Bart Schaefer
2002-10-01 9:35 ` Laurent Wacrenier
2002-10-02 7:18 ` Bart Schaefer [this message]
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=1021002071803.ZM16600@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=lwa@teaser.fr \
--cc=zsh-workers@sunsite.dk \
/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).