zsh-users
 help / color / mirror / code / Atom feed
From: Andrew Gallagher <andrew.gallagher@earthling.net>
To: zsh-users@math.gatech.edu
Subject: Re: Xterm title changing prompt problem: HELP!
Date: Fri, 15 Jan 1999 11:48:04 +0000	[thread overview]
Message-ID: <369F2AF4.5FD78841@earthling.net> (raw)
In-Reply-To: <slrn79sv71.83r.mason@coral.primenet.com.au>

Geoff Wing wrote:

> Shawn Leas <sleas@ixion.honeywell.com> 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\a[%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



  reply	other threads:[~1999-01-15 11:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-14 22:17 Shawn Leas
1999-01-14 23:25 ` Geoff Wing
1999-01-15 11:48   ` Andrew Gallagher [this message]
1999-01-15 11:58     ` Bruce Stephens
1999-01-15 14:29     ` Geoff Wing
1999-01-15 15:41       ` Andrew Gallagher
1999-01-15 17:05         ` Geoff Wing
1999-01-18 10:45           ` Andrew Gallagher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=369F2AF4.5FD78841@earthling.net \
    --to=andrew.gallagher@earthling.net \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).