zsh-workers
 help / color / mirror / code / Atom feed
* Re: forwarded message
@ 1997-06-21  1:48 Wez Furlong
  0 siblings, 0 replies; 7+ messages in thread
From: Wez Furlong @ 1997-06-21  1:48 UTC (permalink / raw)
  To: Richard Coleman, zsh-workers

On Jun 20,  2:32pm, Richard Coleman wrote:

: In brief, it seems that %{...%} is not working properly inside PS1.
: 
: In tcsh, I use
: 
: set prompt="%{\033]2;%n@%M:%/ - %l\007\033]1;%l@%m\007%}%h [%T] %B%n%b@%m:%B%.2%#%b "

As far as I understand the docs, the string between the %{...%} should
not move the cursor in any way - I'm not sure if your sequence moves the
cursor or not (I haven't really looked: this is a quickie mail), but
this is worth checking in detail.

I don't set my titlebar in this way; I use this method:

One of the features of zsh is the precmd function which gets run before
the prompt is printed.

In my precmd function I call another function called title:

function precmd () { 
	title Zsh
};

function title () 
{
	case $TERM in
		iris-ansi*)	print -n -P "\2201.y$* ~ $USER@%m:%~\234\2203.y~ %m:%~\234\2203.y$USER@%m\234" ;;
		xterm*)	print -Pn "\e]2;$* ~ $USER@%m:%~\a\e]1;$USER@%m\a" ;;
	esac	
}

this sets my title for me on both xwsh and xterm.

My prompt variable looks like this:

CSI='^[['
prompt="%{${CSI}0m%} %(18328#::%{${CSI}32m%}%n )%{${CSI}35m%}%m %{${CSI}31m%}tty%l %{${CSI}33m%}~ %{${CSI}36m%}%h %{${CSI}35m%}%03. %(?::%{${CSI}32m%}%? )%{${CSI}0m%}> %(#.#.)"

Where 18328 is my numeric userid. 

Note that the ^[ is actually a quoted ESC put in by vi : I can't
remember if I managed to get it working with \033, but I'd guess not
judging by that ESC :)

Sorry I haven't explained much, but I've gotta go - no doubt some of the
other readers of the list will go into more detail...




-- 
Wez - Electronics Undergraduate at the University of York
URL : http://www.twinklestar.demon.co.uk/

Insult Of The Day: Thou mammering tardy-gaited death-token!


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

* Re: forwarded message
  1997-06-21 15:35       ` Hrvoje Niksic
@ 1997-06-21 15:45         ` Zefram
  0 siblings, 0 replies; 7+ messages in thread
From: Zefram @ 1997-06-21 15:45 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zefram, zsh-workers, roberto

Hrvoje Niksic wrote:
>Then you should probably remove the following text from answer to
>question C8 of the FAQ:
>
>  Arguably the prompt code should handle `print'-like escapes.  Feel
>  free to write this :-).

This is not entirely wrong.  I suggest that the prompt code should
probably accept `%033' as having the same meaning as print's `\033'.
And I may well implement this, it being fairly trivial.

-zefram


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

* Re: forwarded message
  1997-06-21 15:25     ` Zefram
@ 1997-06-21 15:35       ` Hrvoje Niksic
  1997-06-21 15:45         ` Zefram
  0 siblings, 1 reply; 7+ messages in thread
From: Hrvoje Niksic @ 1997-06-21 15:35 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers, roberto

Zefram <zefram@dcs.warwick.ac.uk> writes:

> >What is the issue with these anyway?  I'd think them trivial to code,
> >given all the other stuff Zsh contains.
> 
> They would be trivial, but I do not recommend doing it because it would
> break things.  % is the only special character in PS1, and it is good
> to keep the rule this simple.

Then you should probably remove the following text from answer to
question C8 of the FAQ:

  Arguably the prompt code should handle `print'-like escapes.  Feel
  free to write this :-).

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Thou Who might be our Father Who perhaps may be in Heaven...
                                                -- Roger Zelazny


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

* Re: forwarded message
  1997-06-21 15:20   ` Hrvoje Niksic
@ 1997-06-21 15:25     ` Zefram
  1997-06-21 15:35       ` Hrvoje Niksic
  0 siblings, 1 reply; 7+ messages in thread
From: Zefram @ 1997-06-21 15:25 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zefram, zsh-workers, roberto

Hrvoje Niksic wrote:
>Zefram <zefram@dcs.warwick.ac.uk> writes:
>> The %{...%} is working just fine.  The problem is sequences like
>> "\033", which have no special meaning in PS1.
>
>What is the issue with these anyway?  I'd think them trivial to code,
>given all the other stuff Zsh contains.

They would be trivial, but I do not recommend doing it because it would
break things.  % is the only special character in PS1, and it is good
to keep the rule this simple.

-zefram


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

* Re: forwarded message
  1997-06-21 15:15 ` Zefram
@ 1997-06-21 15:20   ` Hrvoje Niksic
  1997-06-21 15:25     ` Zefram
  0 siblings, 1 reply; 7+ messages in thread
From: Hrvoje Niksic @ 1997-06-21 15:20 UTC (permalink / raw)
  To: Zefram; +Cc: Z Shell workers mailing list, roberto

Zefram <zefram@dcs.warwick.ac.uk> writes:

> The %{...%} is working just fine.  The problem is sequences like
> "\033", which have no special meaning in PS1.

What is the issue with these anyway?  I'd think them trivial to code,
given all the other stuff Zsh contains.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Oh lord won't you buy me a color TV...


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

* Re: forwarded message
  1997-06-20 18:32 Richard Coleman
@ 1997-06-21 15:15 ` Zefram
  1997-06-21 15:20   ` Hrvoje Niksic
  0 siblings, 1 reply; 7+ messages in thread
From: Zefram @ 1997-06-21 15:15 UTC (permalink / raw)
  To: Z Shell workers mailing list; +Cc: roberto

Richard Coleman wrote:
>set prompt="%{\033]2;%n@%M:%/ - %l\007\033]1;%l@%m\007%}%h [%T] %B%n%b@%m:%B%.2%#%b "
>
>to set my xterm icon name & title and prompt.
>
>If I try to use the same kind of strings for zsh, the %{...%} doesn't seem
>to be really interpreted as I'd expect and I get this:
>
>\033]2;roberto@keltia.freenix.fr:/build/zsh-3.1.1 - p2\007\033]1;p2@keltia\007203 [20:14] roberto@keltia:zsh-3.1.12% 

The %{...%} is working just fine.  The problem is sequences like "\033",
which have no special meaning in PS1.  You need to put a literal escape
character into PS1.

-zefram


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

* forwarded message
@ 1997-06-20 18:32 Richard Coleman
  1997-06-21 15:15 ` Zefram
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Coleman @ 1997-06-20 18:32 UTC (permalink / raw)
  To: zsh-workers

This came through on zsh-workers-request.

/rc

------- Forwarded Message

Date: Fri, 20 Jun 1997 14:26:10 -0400 (EDT)
From: Ollivier Robert <roberto@keltia.freenix.fr>
To: zsh-users-request@math.gatech.edu
Subject: [3.1.1-beta] bug with %{...%} ?

Hi everyone,

Using the Jan. 28th version of 3.1.1-beta, I've tumbled on something I
think may be a bug. It also happens with the previous version I compiled
(3.0.2).

In brief, it seems that %{...%} is not working properly inside PS1.

In tcsh, I use

set prompt="%{\033]2;%n@%M:%/ - %l\007\033]1;%l@%m\007%}%h [%T] %B%n%b@%m:%B%.2%#%b "

to set my xterm icon name & title and prompt.

If I try to use the same kind of strings for zsh, the %{...%} doesn't seem
to be really interpreted as I'd expect and I get this:

\033]2;roberto@keltia.freenix.fr:/build/zsh-3.1.1 - p2\007\033]1;p2@keltia\007203 [20:14] roberto@keltia:zsh-3.1.12% 

Is this a bug or did I miss somewhere in the documentation (I've read it)
the correct way to use "%{...%}" ?

If this is fixed in a later version, I'll upgrade of course.

Thanks,

PS: I'm not on the list so please remember to me put in Cc:, thanks.
- -- 
Ollivier ROBERT -=- FreeBSD: There are no limits -=- roberto@keltia.freenix.fr
Usenet Canal Historique

------- End of Forwarded Message


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

end of thread, other threads:[~1997-06-21 15:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-21  1:48 forwarded message Wez Furlong
  -- strict thread matches above, loose matches on Subject: below --
1997-06-20 18:32 Richard Coleman
1997-06-21 15:15 ` Zefram
1997-06-21 15:20   ` Hrvoje Niksic
1997-06-21 15:25     ` Zefram
1997-06-21 15:35       ` Hrvoje Niksic
1997-06-21 15:45         ` Zefram

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