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 <bensberg@telfort.nl>
master
David Lawrence Ramsey 2019-03-04 15:33:49 -06:00 committed by Benno Schulenberg
parent c3cd0f3411
commit 40a74e46e6
1 changed files with 2 additions and 2 deletions

View File

@ -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);