Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: chpwd() & print -Pn



Konstantin Sobolev wrote:
> Hi
> 
> sorry for probably a stupid question.. after upgrading zsh from 4.2.x to 4.3.
> 2 
> my chpwd function meant to update xterm's title stopped working:
> 
> chpwd () { print -Pn '^[]2;%~^G' }
> 
> instead it simply prints this stuff to the console:
> 
> kos@kos /tmp $ cd /tmp
> ^[]2;/tmp^G%
> 
> what could be causing it?

The syntax you're showing only works if the ^[ is a real escape
character and ^G a real control-G:  "print -P" doesn't handle the ^ in
the way that bindkey does.  Maybe you copied this in some way as to turn
it into the characters you've shown?  (The terminal will represent
the characters in the way you've shown on output the same in either
case.)

It's safer to use:

chpwd() { print -Pn '\e]2;%~\a' }

However, this hasn't actually changed since 4.2; I tried 4.0.7 and 4.2.2
and they behaved the same way.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



Messages sorted by: Reverse Date, Date, Thread, Author