On 2007-04-16, Tyler Smith <[EMAIL PROTECTED]> wrote:
> On 2007-04-15, Gerard Robin <[EMAIL PROTECTED]> wrote:
>
>> I encountered the same problem and I solved it adding \]\n[\ in my PS1.
>>
>> my PS1:
>>
>> PS1="${magenta}[\[$TIME\] [EMAIL PROTECTED]
>> \[${BLUE}\]\#\[$NC\]]\w\$ "
>>
>> hth.
>
>
> That's interesting. If I put the \n at the end of my prompt it works
> right. If I put it at the beginning or in the middle I get the same
> problem - the first line wraps at 66 characters, and overwrites the
> line rather than spilling onto the next line. I've discovered that the
> second and presumably all subsequent lines wrap correctly at 80
> characters and spill onto the following line, rather than overwriting
> the current line.
>

Ok, I found a website that explained what I was doing wrong:

http://www-128.ibm.com/developerworks/linux/library/l-tip-prompt/

It wasn't the addition of the battery time output from acpi, it was
the addition of some escaped colour codes that weren't properly nested
in \[ \]. My defective prompt was (split onto two lines for clarity):

'\033[01;31m\]$(bt)\033[00m\]|\033[01;32m\]\u\[\033[00m\]:
                                
\[\033[01;34m\]\W\[\033[00m\]-> '

My corrected prompt is:

'\[\033[01;31m\]$(bt)\[\033[00m\]|\[\033[01;32m\]\u\[\033[00m\]:
 ^^                  ^^           ^^            

\[\033[01;34m\]\W\[\033[00m\]-> '


Maybe that will save someone some trouble in the future.

Cheers,

Tyler


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to