bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PS1 multiline with colors


From: Chris Down
Subject: Re: PS1 multiline with colors
Date: Fri, 5 Jul 2013 00:50:53 +0800

> Repeat-By:
>         With mintty terminal:
>         PS1='\h Hello everybody\n\e[1;35m\]Hi\e[0m\]>'
>         << cursor up >>
>         << cursor down >>
>         the line look like:
>         Hi>PS1='\h Hello
>
>         With putty terminal (with default configuration):
>         with the same PS1, when the cursor is on the last line of the terminal
>         when I call back a long command (displayed on 2 or more lines) from 
> history
>         this line is badly displayed.

You need to properly indicate that the control codes are zero-width
(by using \[ and \]). Without them, this is expected behaviour.

Better, don't hardcode the escape codes for colours -- it is a naive
assumption to believe that all terminals will do what you expect. Use
`tput' instead.

Best,

Chris



reply via email to

[Prev in Thread] Current Thread [Next in Thread]