softwrap: break before multi-column Unicode blanks when they overshoot

In atblanks mode, if a softwrapped chunk ends with a double-width space
character (say, Unicode 003000, Ideographic Space), and that would put
half of the character past the edge of the screen, break before it.

This fixes https://savannah.gnu.org/bugs/?51671.
This commit is contained in:
David Lawrence Ramsey 2017-08-13 11:15:08 -05:00 committed by Benno Schulenberg
parent 3f35e9670f
commit 504a97256b

View File

@ -3054,13 +3054,12 @@ size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
* the pointer back to the last blank, step beyond it, and we're done. */
if (found_blank) {
text = text - index + lastblank_index;
parse_mbchar(text, NULL, &lastblank_column);
char_len = parse_mbchar(text, NULL, &lastblank_column);
text += char_len;
/* If we've now overshot the screen's edge, then break there. */
if (lastblank_column > goal_column)
return goal_column;
return lastblank_column;
/* If we haven't overshot the screen's edge, break after the blank. */
if (lastblank_column <= goal_column)
return lastblank_column;
}
/* If a tab is split over two chunks, break at the screen's edge. */