From edc0d6280acd7f6969d63d48c993cfe608b8e57d Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 5 Feb 2019 14:53:08 -0600 Subject: [PATCH] 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. --- src/winio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/winio.c b/src/winio.c index cc80c7b3..f4f20876 100644 --- a/src/winio.c +++ b/src/winio.c @@ -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