display: represent half of a double-width character with "[" and "]"

When the screen's edge leaves just one column for a two-column
character, then show its left half as "[" and its right half as "]".

(They used to be shown as ">" and "<", but these characters will be
repurposed in the next commit.)

This addresses https://savannah.gnu.org/bugs/?55657.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
master
Benno Schulenberg 2019-02-11 20:44:30 +01:00
parent e7557a9293
commit ad505e7fff
1 changed files with 4 additions and 4 deletions

View File

@ -1903,8 +1903,8 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
column++;
}
/* Display the right half of a two-column character as '<'. */
converted[index++] = '<';
/* Display the right half of a two-column character as ']'. */
converted[index++] = ']';
column++;
buf += parse_mbchar(buf, NULL, NULL);
}
@ -1993,9 +1993,9 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
index = move_mbleft(converted, index);
#ifdef ENABLE_UTF8
/* Display the left half of a two-column character as '>'. */
/* Display the left half of a two-column character as '['. */
if (mbwidth(converted + index) == 2)
converted[index++] = '>';
converted[index++] = '[';
#endif
}