Subject: Re: PS1 and Window title
From: [email-masked] (Michael Ring)
To: Jerome Benoit <[email-masked]>
Cc: Cygnus <[email-masked]>
Date: Tue, 11 Jul 2000 16:45:20 +0200

On Tue, 11 Jul 2000 08:30:33 -0600, you wrote:

>Bonjour:
>
>I set `PS1' as
>
>PS1='\e]0;\H:\w\007GENERIC> '
>
>It works fine for small line command.
>But if the line command is to long (higher then half a line)
>strange behaviours happen:
>1] a second line emerges;
>2] the terminal code appears in clear;
>3] the command line editor goes crazy
>Note that the title remains
>
>Any idea ?
>
>Jerome BENOIT

Although you don't see the escape-codes in your prompt they are taken
into account when calculating the length of the current commandline it
seems. I solved the problem in the following way:

xtitle ()
{
        echo -n -e "\033]0;$*\007"
}

if [ "x$TERM" = "xxterm" ]; then
	export PROMPT_COMMAND="xtitle \$USER@\$HOSTNAME"
fi

PS1='\u@\h{\w} '

PROMPT_COMMAND gets executed each time a new prompt-line is generated.

Hope that helped,

Michael Ring

--
Want to unsubscribe from this list?
Send a message to [email-masked]