From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18417 invoked from network); 15 Jan 1999 11:58:31 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 15 Jan 1999 11:58:31 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id GAA27806; Fri, 15 Jan 1999 06:49:27 -0500 (EST) Resent-Date: Fri, 15 Jan 1999 06:48:57 -0500 (EST) Sender: andrewg@hornet.am.qub.ac.uk Message-ID: <369F2AF4.5FD78841@earthling.net> Date: Fri, 15 Jan 1999 11:48:04 +0000 From: Andrew Gallagher Organization: QUB X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.36 i686) MIME-Version: 1.0 To: zsh-users@math.gatech.edu Subject: Re: Xterm title changing prompt problem: HELP! References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-Message-ID: <"bpUTJ.0.vn6.ciods"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/2021 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Geoff Wing wrote: > Shawn Leas typed: > :This new thing I found is too kewl, but I need a little help. > :However, my right prompt is shifted to the left. I suspect > :This is due to zsh keeping track of the length of the left > :part of the prompt, then adjusting where to put the right one. > :Should I just not have a right prompt? Or is there a way around > :this? > :PROMPT='];[%l] %n@%m %1v (%h) %t[%l] %n@%m %1v (%h) %t ' > ^ insert ``%{'' ^ insert ``%}'' > thus > PROMPT='%{^[];[%l] %n@%m %1v (%h) %t^G%}[%l] %n@%m %1v (%h) %t ' > > >From the manual (section PROMPT EXPANSION): > %{...%} > Include a string as a literal escape sequence. The > string within the braces should not change the cur- > sor position. Brace pairs can nest. > Or alternatively, take the escape sequence out of PROMPT and "echo -n" it from inside the precmd() function ... here is my version: PROMPT='%? //%n@%B%m%b%// %l%1v%!> ' RPROMPT='(%T, %w)' function precmd { echo -n "^[]0;//$USER@$HOSTNAME$PWD/ ($UNAME)^G" } The advantage of this is that it doesn't mess up non-xterm terminals so much (where the escape sequence will not be recognised and thus _will_ shift the cursor). PROMPT will overwrite the "echo -n"ed line whether it is printed or not (so long as it is less than 80 chars). -- Andrew Gallagher http://members.tripod.com/~AndrewGallagher/id.html