bug-ncurses
[Top][All Lists]
Advanced

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

a double-width character can transgress to the next row


From: Benno Schulenberg
Subject: a double-width character can transgress to the next row
Date: Wed, 25 Mar 2020 12:18:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Hello,

When there is a two-column character in the last two columns of a row,
and the terminal window is made one column narrower, then sometimes
this character erroneously appears at the start of the next row.

To demonstrate, download nano-4.9 [1], unpack, ./configure, make, and
make install -- ensure that the LINGUAS environment variable is unset,
or that it includes " ja ".  Make the window of your terminal emulator
80 columns wide and 28 rows high.  Then run:

  LANGUAGE=ja  nano

Verify that you are running nano-4.9 (see in upper left corner).
If that is the case, then type: Ctrl+G.  A help text in Japanese
is displayed.  Note that the last character (み) of the description
of "^R" is wrapped to the next row, and that the row after that is
completely blank.  That is all as it should be.

Now widen the terminal by one column.  The description of ^R now
fits on one row, and the description of ^K has now appeared on the
bottom row of the text window.  Note its last character: 納.

Now make the terminal one column narrower again.  The description
of ^R is spread over two rows again, *but*... the last character
has also appeared at the start of the row after that, the row that
was previously entirely blank.  This is not nano's doing.  If nano
made a mistake, it would have written the character one row earlier.

Also see that the description of ^K has disappeared again (because
there is no room for it in the text window), but that its last
character (納) has appeared at the start of the status bar (the
third row from the bottom).  It should be impossible for nano to
do this: the three bottom rows are a separate subwindow, and
ncurses should prevent things overflowing from the central text
subwindow into the bottom subwindow.

Now type Ctrl+X to exit from the help viewer.  The "み" and "納"
stay where they are.  Nano has rewritten the entire text subwindow
with blank lines, but still the "み" remains.  Now type Ctrl+G
again.  Nano has written a blank line to the status bar, but still
the "納" remains.

I can reproduce this on xterm (344), Xfce Terminal, and urxvt.

When forcing ncurses to really redraw each row of the text subwindow
(see attached patch), then the spurious "み" character is no longer
shown.

So... I think this is a bug in ncurses.  Can you confirm?

(In ncurses before 5.9 there was a bug where a two-column character in
the first two columns of a row was sometimes counted as a one-column
character, causing the row to be misdisplayed when fiddling with it.
Maybe the above bug is a related bug but then at the end of a row?)

Benno


[1]  https://ftpmirror.gnu.org/nano/nano-4.9.tar.xz

(It has to be 4.9 -- older versions display help texts differently.)

Attachment: force-lines-of-edit-window-to-be-redrawn.patch
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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