Re: Offset error (when using PS1 with colors and newline)
From:
dAniel hAhler
Subject:
Re: Offset error (when using PS1 with colors and newline)
Date:
Tue, 2 Oct 2007 04:41:31 +0200
User-agent:
KMail/1.9.6 (enterprise 0.20070907.709405)
On 2007-07-12 Andreas Schwab wrote:
> > 1. Set PS1="\033[01;37m[ \[\033[01;34m\]\w\[\033[00m\]
> > \033[01;37m]\n\$\033[00m "
>
> You need to bracket _every_ nonprinting sequence of characters with \[\].
I've asked you before, but you've not answered, or it got lost.
What nonprinting sequence is not escaped above?
And is there anything unescaped in the testcase below?
1. PS1="\n\[\033[0m\]"
2. Type "ls ./_ /foo" ("_" => cursor)
3. Press TAB twice, where the "_" is above
Result:
--------
ls ./ /foo
[...]
ls ./ /foo _
--------
(where "_" is the cursor again)
I've just tested this with bash 3.2.25(1).
For reference, the bug has been reported at launchpad:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/119938
--
http://daniel.hahler.de/
signature.asc Description: This is a digitally signed message part.