[Top][All Lists]

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

Re: Prompt length calculation fails when UTF-8 is used within \[ \]

From: Lasse Kärkkäinen
Subject: Re: Prompt length calculation fails when UTF-8 is used within \[ \]
Date: Wed, 22 Jul 2009 04:51:05 +0300
User-agent: Thunderbird (X11/20090608)

Steps to reproduce: (using UTF-8 locales)

$ export PS1="\[\e]2;test Ä and Ö here\a\]prompt>"
prompt>abcdefgh    # Enter some alphabets and press Home
     ^ Cursor goes here, instead of
       ^ here where it should go.

Add more UTF-8 letters as non-printable characters in PS1 and the offset
from the correct position gets bigger. Here it was two characters
because of two "extra" bytes in the UTF-8 put in there.

I noticed that you have to type a right amount of characters to make
Home key use the calculated prompt length. abcdefgh seems to work in
this case, but if the prompt is modified, you may need to type more or
less than that to see the effect.

Tested with versions:
GNU bash, version 4.0.0(2)-release (x86_64-unknown-linux-gnu)

Can you reproduce this with bash-4.0 with all 24 patches applied?  I
still have more testing to do, but I haven't been able to reproduce
it on my Mac OS X development machines.

Which patches? Do you use some kind of VCS where I could just get the current source directly?

reply via email to

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