[Top][All Lists]

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

Re: regression with color prompt + utf8

From: Chet Ramey
Subject: Re: regression with color prompt + utf8
Date: Sun, 05 Feb 2006 15:49:38 -0500
User-agent: Thunderbird 1.5 (Macintosh/20051201)

> Bash Version: 3.1
> Patch Level: 5
> Release Status: release
> Description:
> Hi,
> I have a nice color prompt:
> export PS1=$'\\[\017\E[10;0m\E[1;address@hidden:\\w\\$ \\[\E[0m\\]'
> and use UTF-8 locales everywhere.
> When the output of a command doesn't end with a newline, I could perfectly
> see it in bash 3.0 since the prompt was printed on its right:
> address@hidden:~$ echo -n foobar
> address@hidden:~$ 
> Is is also okay in bash 3.1 with 8-bit locales or with simple prompts.
> However, if both colors are used in the prompt, and an UTF-8 locale is in
> effect, the prompt overwrites the output:
> address@hidden:~$ echo -n foobar
> address@hidden:~$ ek:~$ 
>                 ^
>                 the cursor stands here
> (actually that leftover part of the prompt suggest that probably the prompt
> is printed twice, first at the right place (after foobar) and then at the
> end of the line).

If I'm reading this right, it's not a regression, per se.  It's always
possible to fool the redisplay code by violating the assumptions it
starts with, e.g., that the cursor always begins at column 0.

One thing that bash-3.0 did, especially when using prompts with non-
printing characters in multibyte locales, was issue many more carriage
returns than necessary and display the prompt string multiple times,
throwing in some clear-to-eol terminal sequences.  This resulted in
some redisplay errors.

Bash-3.1 redraws the prompt many fewer times (3.2 will be better still),
but redraws a prompt with invisible characters at least one extra time
in a multibyte locale, resulting in the behavior you see.

However, the real problem is that readline thinks the cursor is
somewhere other than it is, which causes errors in its screen position
calculations.  Even if the prompt is redrawn only once, eventually it
will make a redisplay mistake.

``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live Strong.
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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