From 40a74e46e61747ad905bf2bbcb538b62526f0a37 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 4 Mar 2019 15:33:49 -0600 Subject: [PATCH] display: correct the logic for making room for the ">" character The change in commit edc0d628 was flawed. The old logic covered every case but one: having reached the end of 'buf' but 'column' still having overshot the screen width. Now cover this latter case too. This fixes https://savannah.gnu.org/bugs/?55638 properly, allowing the next commit to fix another buglet. Condensed-by: Benno Schulenberg --- src/winio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/winio.c b/src/winio.c index de94dbdf..d0c18c1e 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1991,8 +1991,8 @@ char *display_string(const char *buf, size_t column, size_t span, } /* If there is more text than can be shown, make room for the ">". */ - if ((*buf != '\0' || column > beyond) && - (isprompt || (isdata && !ISSET(SOFTWRAP)))) { + if (column > beyond || (*buf != '\0' && (isprompt || + (isdata && !ISSET(SOFTWRAP))))) { do { index = move_mbleft(converted, index); } while (mbwidth(converted + index) == 0);