This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PS1 and Window title


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 cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]