From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19750 invoked from network); 21 Mar 2001 16:03:17 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Mar 2001 16:03:17 -0000 Received: (qmail 3041 invoked by alias); 21 Mar 2001 16:02:58 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3716 Received: (qmail 3017 invoked from network); 21 Mar 2001 16:02:55 -0000 From: "Bart Schaefer" Message-Id: <1010321160116.ZM17613@candle.brasslantern.com> Date: Wed, 21 Mar 2001 16:01:16 +0000 References: <20010321142303.B8924@thelonious.new.ox.ac.uk> <20010321151448.4320.qmail@web9301.mail.yahoo.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh users mailing list Subject: Re: non-greedy matching? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 21, 2:23pm, Adam Spiers wrote: } Subject: non-greedy matching? } } ..... | perl -pe 's/%{.*?%}//g' } } They are done in order to strip control characters from a prompt so } that its display width can be determined. I had to do something similar in prompt_bart_setup, and ended up with this: ${#${(%%f)${PS1//[%]\{[^%]#%\}/}}[1]} The (f) and [1] are because of the multi-line PS1, where it computes the length only of the first line. The above works as long as you don't have other prompt escapes inside the %{ %}. Hmm. Perhaps this: ${#${(%%)${prompt_line_1a//[%]\{([^%]|%[^\}])#%\}/}}} Looking at prompt_adam2_precmd, it does exactly what prompt_bart_precmd does: compute a padding width by subtracting from $COLUMNS. With the above expression you can get rid of prompt_line_1[ab]_no_color entirely: prompt_padding_size=$(( COLUMNS - ${#${(%%)${prompt_line_1a//[%]\{([^%]|%[^\}])#%\}/}}} - ${#${(%%)${prompt_line_1b//[%]\{([^%]|%[^\}])#%\}/}}} )) Which also, as Sven mentioned, gets rid of $(print -P ...). -- 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