Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Escape characters in $psvar[]
- X-seq: zsh-workers 28422
- From: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Escape characters in $psvar[]
- Date: Fri, 19 Nov 2010 14:03:13 +0000
- Cc: idl0r.qasl.de@xxxxxxxxxxxxxxxx
- In-reply-to: <871v6h79cs.fsf@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <871v6h79cs.fsf@xxxxxxxxxxxxxxxxxxxxxx>
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 <pws@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author