Martin,

On Thursday 05 April 2007 08:55, Martin J Hooper wrote:
> Randall R Schulz wrote:
> > Martin,
> > Most likely there's a problem with your PS1 string. It appears
> > you're altering the color within the prompt, and any portions of
> > the prompt string that do not yield visible characters must be
> > surrounded with \[ (two characters, escape as necessary) and \].
> > Otherwise the cursor positioning code used when you, say back up
> > the cursor, erase parts of the line or wrap at the right margin,
> > have the wrong value for the cursor's position following the prompt
> > and subsequently send incorrect positioning commands.
> >
> >
> > Randall Schulz
>
> Here is the part of .bashrc that changes the cursor - I have not much
> knowledge about whats going on here...
>
> # Define a few Color's
> BLACK='\e[0;30m'
> ...
> WHITE='\e[1;37m'
> NC='\e[0m'              # No Color
>
>
> PS1="$CYAN$(ppwd \l)[EMAIL PROTECTED]:\W$NC >"

And that is definitely the problem. Change the PS1-setting command to 
this:

PS1="\[$CYAN\]$(ppwd \l)[EMAIL PROTECTED]:\W\[$NC\] >"


The command "ppwd" is new to me. In my shell, it's a shell procedure 
defined in /etc/bash.bashrc and emits multiple terminal escape 
sequences but does not appear to enclose them in the required \[ and 
\]. The comment on its definition is "Set xterm prompt with short path 
(last 18 characters)". I tried using it in a BASH shell in Konsole, and 
it yields no prompt at all. I'd probably drop it and directly refer to 
the values you want in your prompt: $USER, $HOST, $PWD etc. Do you care 
which terminal you're using (\l is replaced by "the basename of the 
shell's terminal device name" (search for PS1 in the BASH man page).


Randall Schulz
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to