zsh-users
 help / color / mirror / code / Atom feed
* chpwd() & print -Pn
@ 2006-03-08 17:10 Konstantin Sobolev
  2006-03-08 17:39 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Sobolev @ 2006-03-08 17:10 UTC (permalink / raw)
  To: zsh-users

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?

-- 
/KoS
* MPU-401s: All they ever think about is Hex!			      


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

* Re: chpwd() & print -Pn
  2006-03-08 17:10 chpwd() & print -Pn Konstantin Sobolev
@ 2006-03-08 17:39 ` Peter Stephenson
  2006-03-08 20:50   ` Konstantin Sobolev
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2006-03-08 17:39 UTC (permalink / raw)
  To: zsh-users

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@csr.com>                  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


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

* Re: chpwd() & print -Pn
  2006-03-08 17:39 ` Peter Stephenson
@ 2006-03-08 20:50   ` Konstantin Sobolev
  0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Sobolev @ 2006-03-08 20:50 UTC (permalink / raw)
  To: zsh-users

On Wednesday 08 March 2006 20:39, Peter Stephenson wrote:
> > 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.)

No, I've copied the function from the .zshrc file. ^[ is really there.

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

strangely enough, my sequence really works, xterm title is changed. But this 
crap is printed after each 'cd'.

However, your variant works flawlessly, I'll use it :)
Thanks.

-- 
/KoS
* Dancing with Wolves, Sleeping with beavers			      


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

end of thread, other threads:[~2006-03-08 20:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-08 17:10 chpwd() & print -Pn Konstantin Sobolev
2006-03-08 17:39 ` Peter Stephenson
2006-03-08 20:50   ` Konstantin Sobolev

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