From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12369 invoked by alias); 1 Jun 2010 21:22:53 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27983 Received: (qmail 21444 invoked from network); 1 Jun 2010 21:22:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.33 as permitted sender) Date: Tue, 1 Jun 2010 22:07:00 +0100 From: Peter Stephenson To: zsh workers Subject: Re: %F{1} outputs code twice, %F{red} doesn't Message-ID: <20100601220700.6e7be66e@pws-pc> In-Reply-To: References: X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=W3tOLUehizD4qj6VhtReFuw5MKb8d+XqjIxlDsIazEA= c=1 sm=0 a=IyWfLiF75eQA:10 a=0qYQvVkOOIcA:10 a=DogomfpGjd0A:10 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=NLZqzBF-AAAA:8 a=o_k1ZBlf8HFqYVGd1AcA:9 a=HkWE-01lMK4UYeiGtHUA:7 a=oo2ABEDIbjZh1wIP6gSJitOdFwoA:4 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 a=_dQi-Dcv4p4A:10 a=LYKTPG6UB4PN7fxA:21 a=aosxvMLDev8nrXpW:21 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Fri, 28 May 2010 00:26:49 +0200 Mikael Magnusson wrote: > % print -P a%F{1}a|cat -v > a^[[38;5;1m^[[38;5;1ma > % echo ${(%V):-a%F{1}a} > a^[[38;5;1m^[[38;5;1ma > > (wasn't sure if those use the same code path) > > % print -P a%F{red}a|cat -v > a^[[38;5;1ma I'm not sure how you get it duplicated, but it does look to me like it's trying to do the same thing two ways, one with termcap, and one with ANSI sequences, or whatever you've told it to use instead via zle_highlight. I'm not absolutely sure what I was doing, but I think I must have meant to return if the termcap code was found, and only drop through after that if it was an ANSI colour. However, I'm not sure even that's necessarily correct, it might be best just to try it in case the user is smarter than termcap and has set up zle_highlight appropriately. Any better theories... Index: Src/prompt.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v retrieving revision 1.59 diff -p -u -r1.59 prompt.c --- Src/prompt.c 10 Jul 2009 21:32:49 -0000 1.59 +++ Src/prompt.c 1 Jun 2010 20:59:48 -0000 @@ -1925,8 +1925,13 @@ set_colour_attribute(int atr, int fg_bg, } else { tputs(tgoto(tcstr[tc], colour, colour), 1, putshout); } + /* That worked. */ + return; } - /* for 0 to 7 assume standard ANSI works, otherwise it won't. */ + /* + * Nope, that didn't work. + * If 0 to 7, assume standard ANSI works, otherwise it won't. + */ if (colour > 7) return; } -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/