From: Peter Stephenson <Peter.Stephenson@csr.com>
To: zsh-workers@zsh.org
Cc: idl0r.qasl.de@bones.voodoo.lan
Subject: Re: Escape characters in $psvar[]
Date: Fri, 19 Nov 2010 14:03:13 +0000 [thread overview]
Message-ID: <20101119140313.4ffdb097@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <871v6h79cs.fsf@ft.bewatermyfriend.org>
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@csr.com> 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
next prev parent reply other threads:[~2010-11-19 15:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-19 13:04 Frank Terbeck
2010-11-19 14:03 ` Peter Stephenson [this message]
2010-11-19 14:06 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101119140313.4ffdb097@pwslap01u.europe.root.pri \
--to=peter.stephenson@csr.com \
--cc=idl0r.qasl.de@bones.voodoo.lan \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).