Re: Lengthy working dir (\w) breaks wrapping in a multi line coloured PS
From:
Chet Ramey
Subject:
Re: Lengthy working dir (\w) breaks wrapping in a multi line coloured PS1 prompt
Date:
Fri, 27 Dec 2013 13:14:21 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1
On 12/17/13 9:59 AM, Jinesh Choksi wrote:
> Bash Version: 4.2
> Patch Level: 45
> Release Status: release
>
> Description:
> The simplest PS1 prompt which demonstrates the issue is:
>
> PS1="\[\033[01;31m\]Hello world\n\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] "
>
> The issue is that a lengthy current working directory gets split up before
> the width of the terminal is reached.
>
> This happens only when colour sequences are used. When no colour sequences
> are used, the prompt works correctly.
This is the result of the \n in the prompt, believe it or not. I have
attached a patch, and the patch will be in bash-4.3/readline-6.3. I
would appreciate as many people as possible testing it.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/