* esc seq in prompt
@ 2000-07-13 1:07 Scott Smedley
2000-07-13 1:43 ` Zefram
0 siblings, 1 reply; 2+ messages in thread
From: Scott Smedley @ 2000-07-13 1:07 UTC (permalink / raw)
To: zsh-users
Hi,
I'm having a small trouble with the command-line completion
system when I have escape sequences in my PROMPT environment variable.
Basically, the cursor jumps to the right of screen (spaces are
inserted?) & confuses the hell out of mE when I hit TAB in a
directory & get multiple matches.
Below is a copy of the *entire* .zshrc file I'm using to try &
debug this. I'd love some help or a pointer to get around this.
burns>> echo $ZSH_VERSION
3.1.9-dev-1
burns>> uname -a
Linux burns 2.2.12-20 #1 Mon Sep 27 10:40:35 EDT 1999 i686 unknown
=== cut: .zshrc ===
setPrompt ()
{
rv=$?
local red green white errno color1 color2
red=`print -nP '\e[\033[31;;1m'`
green=`print -nP '\e[\033[32;;1m'`
white=`print -nP '\e[\033[37;;1m'`
errno=""
if [ $rv = 0 ] ; then
color1=$green
color2=$green
else
color2=$red
if [ $rv = 1 ] ; then
color1=$green
else
color1=$red
if [ $rv != 2 ] ; then
errno="($rv)"
fi
fi
fi
export PROMPT=$green$MACHINE$color1$errno">"$color2"> "$white
}
export MACHINE=`uname -n`
precmd ()
{
setPrompt
}
=== end: .zshrc ===
SCoTT! :)
--------------------
scott@mobinfo.com.au
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: esc seq in prompt
2000-07-13 1:07 esc seq in prompt Scott Smedley
@ 2000-07-13 1:43 ` Zefram
0 siblings, 0 replies; 2+ messages in thread
From: Zefram @ 2000-07-13 1:43 UTC (permalink / raw)
To: Scott Smedley; +Cc: zsh-users
Scott Smedley wrote:
> red=`print -nP '\e[\033[31;;1m'`
red=$'\e[31m'
etc. You have the \e[ part doubled, and it's more efficient to use $''.
> export PROMPT=$green$MACHINE$color1$errno">"$color2"> "$white
PROMPT="%{$green%}$MACHINE%{$color1%}$errno>%{$color2%}> %{$white%}"
%{ and %} must surround all parts of the prompt that don't affect the
cursor position. Otherwise zsh has no idea how much space the prompt
will take up on the screen.
This is addressed in the FAQ, question 3.25.
-zefram
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-07-13 1:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-13 1:07 esc seq in prompt Scott Smedley
2000-07-13 1:43 ` 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).