From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3350 invoked by alias); 19 Nov 2010 15:10:36 -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: 28422 Received: (qmail 7247 invoked from network); 19 Nov 2010 15:10:34 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Fri, 19 Nov 2010 14:03:13 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Cc: idl0r.qasl.de@bones.voodoo.lan Subject: Re: Escape characters in $psvar[] Message-ID: <20101119140313.4ffdb097@pwslap01u.europe.root.pri> In-Reply-To: <871v6h79cs.fsf@ft.bewatermyfriend.org> References: <871v6h79cs.fsf@ft.bewatermyfriend.org> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Nov 2010 14:03:13.0988 (UTC) FILETIME=[81CF6840:01CB87F2] X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.68.1.163 On Fri, 19 Nov 2010 14:04:35 +0100 > A user uses the `clint' prompt, which uses `psvar' to include results > from `vcs_info'. He wanted to include colour codes in the vcs_info > formats for proper eye candy. Which resulted in literal "^[[35m" > strings in the actual prompt instead of colours. > > It seems using $psvar[] replaces escape characters (ascii 0x1b) with > two characters: `^' and `[': > > Is that indented behaviour or a bug? A quick skim through the docs > didn't turn up an answer. psvar is sanitized by going through nicechar(), or equivalent, so it appears to be deliberate if undocumented. I think one of the points of psvar is to protect it from funny goings on in prompt expansion; you can set $prompt_subst and use $psvar[1] if you prefer the other way. You'd need to surround with %{ ... %} however you did it, or use the new colour codes. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom