display: account for zero-width characters when reserving space for '>'

That is: keep nibbling off characters until a character is eaten that
takes up at least one column.

This fixes https://savannah.gnu.org/bugs/?55759.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>

Bug existed since version 2.8.0, commit 5283acdc.
master
Benno Schulenberg 2019-02-22 14:09:17 +01:00
parent 031166c34d
commit 7c30d1fa69
1 changed files with 3 additions and 1 deletions

View File

@ -1990,7 +1990,9 @@ 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 ">". */
if ((*buf != '\0' || column > beyond) &&
(currmenu != MMAIN || (isdata && !ISSET(SOFTWRAP)))) {
do {
index = move_mbleft(converted, index);
} while (mbwidth(converted + index) == 0);
#ifdef ENABLE_UTF8
/* Display the left half of a two-column character as '['. */