Package: bash
Version: 3.2-4

It seems that BASH is confused by embedded colours in the prompt (PS1). I have 
e.g. ps1=\e[32...@\h:\w\$ \e[39m, which colours the prompt in green (or in 
red for root). Now, when browsing the history (up/down keys) or when moving 
the cursor (home/end keys but _not_ left/right keys) the cursor is sometimes 
positioned wrongly, but typically only on longer lines.

For a test, just set PS1 to above value (PS1="\\e[32m...@\\h:\\w\\$ \\e[39m"). 
Then, type
 #2345678901234567890123456789012
If you now press home/end, you can jump to the beginning or end. If you add 
another character, this stops working correctly, the home-key positions the 
cursor on the first '1', ten characters off the '#'.

Actually, this is not a reliable recipe for reproduction, since it also 
depends on the length of the prompt ("eckha...@tuxator2:~$ " here). If I cd 
into ~/tmp, the prompt changes and I also need more characters to reproduce 
the problem.

I guess the problem is the width required for printing the colour-change 
escape sequence is something completely different than strlen("\e[32m"), 
rather it is (of course) zero. Now, while the \e (for ESC) seems to be 
interpreted correctly as zero-width, the following [32m aren't, leading to 
the cursor being placed incorrectly.

I would try storing the cursor position after printing the prompt, that way 
you have a working reference that doesn't depend on how the terminal 
interprets e.g. the colour.

Cheers!

Uli 

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten 
bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen 
Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein 
sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, 
weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte 
Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht 
verantwortlich.
**************************************************************************************




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to