display: properly trim double-width characters at the edit window's edge

When a line ends with a two-column character, and this character straddles
the edit window's edge, then, although we've reached the end of 'buf', we
have exceeded the 'beyond' column and this two-column character needs to
be trimmed from the 'converted' string, otherwise it would get printed on
the next row.

This fixes https://savannah.gnu.org/bugs/?55638.

Bug existed since version 2.8.0, commit 5283acdc.
master
David Lawrence Ramsey 2019-02-05 14:53:08 -06:00 committed by Benno Schulenberg
parent 6470106eef
commit edc0d6280a
1 changed files with 1 additions and 1 deletions

View File

@ -1988,7 +1988,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
}
/* If there is more text than can be shown, make room for the $ or >. */
if (*buf != '\0' && (column > beyond || (isdata && !ISSET(SOFTWRAP)))) {
if ((*buf != '\0' || column > beyond) && isdata && !ISSET(SOFTWRAP)) {
index = move_mbleft(converted, index);
#ifdef ENABLE_UTF8