From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23915 invoked from network); 2 Oct 2002 07:18:51 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 Oct 2002 07:18:51 -0000 Received: (qmail 6705 invoked by alias); 2 Oct 2002 07:18:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17755 Received: (qmail 6671 invoked from network); 2 Oct 2002 07:18:34 -0000 From: "Bart Schaefer" Message-Id: <1021002071803.ZM16600@candle.brasslantern.com> Date: Wed, 2 Oct 2002 07:18:02 +0000 In-Reply-To: <20021001093555.GA78178@victor.teaser.fr> Comments: In reply to Laurent Wacrenier "Re: PATCH Re: infinite loop in prompt expansion" (Oct 1, 11:35am) References: <20020930145117.GA35025@victor.teaser.fr> <1020930183230.ZM12902@candle.brasslantern.com> <20021001093555.GA78178@victor.teaser.fr> X-Mailer: Z-Mail (5.0.0 30July97) To: Laurent Wacrenier Subject: Re: PATCH Re: infinite loop in prompt expansion Cc: zsh-workers@sunsite.dk MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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 =E9crit: } > 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' =2E./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= =2E -- = 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 = =