From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2002 invoked from network); 7 May 2008 16:18:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 May 2008 16:18:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 33338 invoked from network); 7 May 2008 16:18:49 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 May 2008 16:18:49 -0000 Received: (qmail 2501 invoked by alias); 7 May 2008 16:18:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24962 Received: (qmail 2483 invoked from network); 7 May 2008 16:18:45 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 7 May 2008 16:18:45 -0000 Received: from n4.bullet.ukl.yahoo.com (n4.bullet.ukl.yahoo.com [217.146.182.181]) by bifrost.dotsrc.org (Postfix) with SMTP id 9625180ED173 for ; Wed, 7 May 2008 18:18:42 +0200 (CEST) Received: from [217.146.182.177] by n4.bullet.ukl.yahoo.com with NNFMP; 07 May 2008 16:18:41 -0000 Received: from [87.248.111.145] by t3.bullet.ukl.yahoo.com with NNFMP; 07 May 2008 16:18:41 -0000 Received: from [127.0.0.1] by omp202.mail.ukl.yahoo.com with NNFMP; 07 May 2008 16:18:41 -0000 X-Yahoo-Newman-Id: 412299.4178.bm@omp202.mail.ukl.yahoo.com Received: (qmail 8361 invoked from network); 7 May 2008 15:43:27 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=nVgJSA12zgoi1rts1JEXRRW69pSuu/ibCwwclN6vN+JlTcpqTJ8pySndoveq4aLoGqTDySjZXVlXsRczJ5mBtsrcgrxLObYXw+9BT1f21oDPOcPy7aB12KDaZk4rmhdbO1d/gVhcGGEIX5F6OLagoZ/fArGQ/SiGnupc0NjsJh8= ; Received: from unknown (HELO thecus) (okiddle@89.48.22.187 with plain) by smtp107.mail.ukl.yahoo.com with SMTP; 7 May 2008 15:43:26 -0000 X-YMail-OSG: Bi2PBncVM1kMSdj8rzkMaADfBqKHBXBNUoAItw6O3xVwjQcnxlvFityZimlh.iNoz7RF69lTG1zFEfPfO5CBjhAdzf5oNqprIqqQ7HfT_C1YqfXVPav2KGeeMv1cRTcAqEE6wXgUHZL0Td0_ohpmMqcHgba20Fjl0WSB6pAangYK5ncYIg-- X-Yahoo-Newman-Property: ymail-3 Received: from localhost ([127.0.0.1] helo=thecus) by thecus with esmtp (Exim 4.63) (envelope-from ) id 1JtloN-0007t3-RI for zsh-workers@sunsite.dk; Wed, 07 May 2008 17:44:07 +0200 In-reply-to: <20080506191611.79fdf69a@news01> From: Oliver Kiddle References: <200805060915.m469FeJP017551@news01.csr.com> <080506073442.ZM22499@torch.brasslantern.com> <200805061442.m46Eg7bN000588@news01.csr.com> <080506075838.ZM1161@torch.brasslantern.com> <200805061510.m46FA71C001035@news01.csr.com> <080506083802.ZM1323@torch.brasslantern.com> <200805061548.m46Fmq2X013524@news01.csr.com> <20080506191611.79fdf69a@news01> To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: random attribute stuff Date: Wed, 07 May 2008 17:44:07 +0200 Message-ID: <30320.1210175047@thecus> X-Virus-Scanned: ClamAV 0.91.2/7046/Wed May 7 05:35:44 2008 on bifrost X-Virus-Status: Clean Peter wrote: > > > } It ought to be (but might turn out not to be) fairly easy to add a > > > } "default" element to zle_highlight that causes the given attributes to This is definitely useful. Leaving attributes on at then end of the prompt is something I always used to do. It still works except that it all gets messed up by menu completion. I'm not sure about coloured completion listings because I don't use them. In any case, it was enough that I stopped leaving attributes on after the prompt. I've attached a patch which changes prompt_oliver_setup to use zle_highlight. This fixes things for the interaction with region_highlight from my bracket matching widget but is still broken when I use menu completion. It is especially broken if the bold attribute is set: I get >= symbols around the matches. Given that zsh now has internal knowledge that "green" is ESC [32m and so on, would it be wise to allow this in prompt escapes: %A{fg=green} perhaps? Or maybe support a prompt element in zle_highlight. I've only ever used single colour prompts. Support for more than 16 colours would also be good. SGI's terminal supported them 15 years ago. Oliver Index: prompt_oliver_setup =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_oliver_setup,v retrieving revision 1.3 diff -u -r1.3 prompt_oliver_setup --- prompt_oliver_setup 31 Jan 2002 15:30:42 -0000 1.3 +++ prompt_oliver_setup 7 May 2008 15:24:23 -0000 @@ -23,21 +23,22 @@ [[ "${(t)pcolour}" != assoc* ]] && typeset -Ag pcolour [[ "${(t)tcolour}" != assoc* ]] && typeset -Ag tcolour - local pcol=${1:-${pcolour[${HOST:=`hostname`}]:-yellow}} + local pcol=${1:-${pcolour[${HOST:=`hostname`}]:-bold}} local pcolr=$fg[${pcol#bold}] - [[ $pcol = bold* ]] && pcolr=$bold_color$pcolr + [[ $pcol = bold* ]] && pcolr=%B$pcolr - local tcol=${2:-${tcolour[$HOST]:-white}} - local tcolr=$reset_color$fg[${tcol#bold}] - [[ $tcol = bold* ]] && tcolr=$tcolr$bold_color + local tcol=${2:-${tcolour[$HOST]}} + local tcolr="fg=${tcol#bold}" + [[ $tcol = bold* ]] && tcolr=bold,$tcolr local a host="%m:" user="%n " [[ $HOST == (${(j(|))~normal_hosts}) ]] && host="" - [[ ${USER:-`whoami`} == (root|${(j(|))~normal_users}) ]] && user="" + [[ $LOGNAME == (root|${(j(|))~normal_users}) ]] && user="" - PS1="%{$pcolr%}$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%1(j.%%%j.)%0(?..:%?)]%# %{$tcolr%}" + PS1="%{$pcolr%}$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%1(j.%%%j.)%0(?..:%?)]%# %{$reset_color%}" RPS2='<%^' PS2='' + zle_highlight[(r)default:*]=default:$tcolr } prompt_oliver_setup "$@"