bug-ncurses
[Top][All Lists]
Advanced

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

Re: a double-width character can transgress to the next row


From: Thomas Dickey
Subject: Re: a double-width character can transgress to the next row
Date: Tue, 14 Apr 2020 19:56:55 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Apr 14, 2020 at 02:23:36PM +0200, Benno Schulenberg wrote:
> 
> Op 14-04-2020 om 01:32 schreef Thomas Dickey:
> > On Mon, Apr 13, 2020 at 05:46:46PM +0200, Benno Schulenberg wrote:
> >> Okay, how can I now get ncurses to dump its screen buffer to a file
> >> at specific points in the program?
> > 
> > see attached (I modified doupdate)
> 
> Thanks.  With just the modified tty_update.c, running my recipe results
> in nine screen dumps, numbered from 0 to 8.  Going from number 1 to 2,
> the screen has widened, and all rows get an extra \s at the end.  Then,
> going to number 3, nano redraws the screen adjusted for the new width,
> and for row 21 the final \s\s get replaced with \u307f.  So far so good.
> 
> Now, going from dump number 4 to 5, the screen has narrowed again and
> all rows lose an \s at the end -- except for row 21 and 25: they don't
> lose the \u307f and \u7d0d at the end!  Only when going from dump 5 to 6,
> when nano has redrawn the screen for the narrower width, do the \u307f
> and \u7d0d get replaced by a single \s each.  But by then the badness
> has already happened: the terminal has drawn the transgressing characters
> on the succeeding row.
> 
> So, it seems something goes wrong when ncurses shrinks a window: a
> double-width character that overshoots the total width of the window
> does not get replaced with a space (or something) but is left alone.

It's more complicated than that: some of the characters are "known"
to be "fullwidth" (2 cells) and some are not.  It's not clear in the
dump which are (so counting characters can be misleading).

I used scr_dump as an initial check, to see if the interesting glyphs were
really misplaced.  Looking at the dump and the actual screen, the two did
not match for the problematic cells.  To debug that, I'll probably add some
(temporary...) debugging trace to see the characters at each column
along with the widths according to wcwidth.  (Someone who's really
familiar with the characters could probably see the error right away :-)

...that's for the weekend - when I normally work on ncurses
   (I'm doing maintenance on other stuff now)

-- 
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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