On Sat, Jul 02, 2005 at 03:49:01PM -0400, Daniel Burrows wrote:
> Package: libncursesw5
> Version: 5.4-8
> Severity: normal
> 
>   I've just finished converting aptitude's display routines to understand 
> about >8-bit character set locales such as utf8.  Everything works fine in 
> typical European locales -- however, when I tried setting the locale to 
> zh_CN, I noticed some display artifacts.  After a bit of experimentation, I 
> believe that I've found the general situation that's causing this problem.  
> As you probably know, Chinese characters are "wide" -- by which I mean that 
> they take two columns on the text terminal.  The problem I'm encountering 
> occurs when a wide character is *partially* overlapped by a non-wide 
> character.  For instance, you can see this when a popup menu appears on top 
> of a background of wide-character text:

I can see where the problem is, will make a fix in the next patch.
Other than the usual distractions, it took a few hours debugging due
to the large size of the trace when running aptitude (to see how to
get the information I needed).  It seems that aptitude creates a _lot_
of windows (my first cut of a trace got 300Mb of trace).  aptitude
would probably run faster if it didn't do that.

Anyway, the problem is that for the special case I'm seeing,
ncurses/tty/tty_update.c is doing the wrong thing when there's
an overlapped character.  This is the chunk that's wrong (around
line 1300):

            if (oLastChar < nLastChar) {
                int m = max(nLastNonblank, oLastNonblank);
                GoTo(lineno, n + 1);
                if (
#if USE_WIDEC_SUPPORT
                       isWidecExt(newLine[n + 1]) ||
#endif
                       InsCharCost(nLastChar - oLastChar) > (m - n)) {
                    PutRange(oldLine, newLine, lineno, n + 1, m);
                } else {
                    InsStr(&newLine[n + 1], nLastChar - oLastChar);
                }

The isWidecExt() ifdef is new since 5.4, and for this particular case is
applied too late to work properly.  Also if the InsStr() branch is taken,
I see the menu border overwritten.  So there are two problems in that
chunk.

(I have a preliminary fix, but it was late at night -have to review ;-)

-- 
Thomas E. Dickey <[EMAIL PROTECTED]>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature

Reply via email to