From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27320 invoked by alias); 19 Nov 2010 13:21:00 -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: 28420 Received: (qmail 4188 invoked from network); 19 Nov 2010 13:20:45 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: zsh-workers@zsh.org Cc: idl0r.qasl.de@bones.voodoo.lan Subject: Escape characters in $psvar[] User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Date: Fri, 19 Nov 2010 14:04:35 +0100 Message-ID: <871v6h79cs.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Df-Sender: 430444 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