commit 504a97256bfedfc78b0d274195820ca9a5ef426a
parent 3f35e9670f48b7f64eab92119cc50216594d1a23
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sun, 13 Aug 2017 11:15:08 -0500
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.
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -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);
-
- /* If we've now overshot the screen's edge, then break there. */
- if (lastblank_column > goal_column)
- return goal_column;
+ char_len = parse_mbchar(text, NULL, &lastblank_column);
+ text += char_len;
- 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. */