diff --git a/src/winio.c b/src/winio.c index 47ccb21f846db9a049ad002b5b26ac9f60c2b3e8..a790f498c1dfe674f5b637cf6c6ee4e4b3f928e8 100644 --- 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. */