[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: Chet Ramey
Subject: Re: Prompt length calculation fails when UTF-8 is used within \[ \]
Date: Sun, 19 Jul 2009 23:46:54 -0400
User-agent: Thunderbird (Macintosh/20090605)

Lasse Kärkkäinen wrote:
> 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.

``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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