zsh-workers
 help / color / mirror / code / Atom feed
* Escape characters in $psvar[]
@ 2010-11-19 13:04 Frank Terbeck
  2010-11-19 14:03 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Terbeck @ 2010-11-19 13:04 UTC (permalink / raw)
  To: zsh-workers; +Cc: idl0r.qasl.de

Hey list,

The following came up on IRC.

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 `[':

[snip]
% autoload -Uz colors
% colors
% psvar[9]=$fg[red]foo
% print ${psvar[9]} | hd -c
00000000  1b 5b 33 31 6d 66 6f 6f  0a                       |.[31mfoo.|
0000000 033   [   3   1   m   f   o   o  \n                            
0000009
% print -P '%9v' | hd -c
00000000  5e 5b 5b 33 31 6d 66 6f  6f 0a                    |^[[31mfoo.|
0000000   ^   [   [   3   1   m   f   o   o  \n                        
000000a
[snap]

Is that indented behaviour or a bug? A quick skim through the docs
didn't turn up an answer.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-19 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-19 13:04 Escape characters in $psvar[] Frank Terbeck
2010-11-19 14:03 ` Peter Stephenson
2010-11-19 14:06   ` Peter Stephenson

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).