This could happen when the space was inserted between lines: it could trigger
wrapping before there was actually an overflow.
inhibitbreak = 0;
while (*pos != '\0') {
if (txt->wrapwidth != 0 && width >= txt->wrapwidth &&
- !peeking && linebreak > wrapindentlen)
+ !peeking && linebreak > wrapindentlen &&
+ linebreak < len)
break;
if ((unsigned char)*pos > 0xbf && txt->skip == NULL &&
txt->wrapmode == WRAP_CHAR &&
if (txt->wrapwidth != 0 && !peeking) {
if (width < txt->wrapwidth ||
- linebreak <= wrapindentlen) {
+ linebreak <= wrapindentlen ||
+ linebreak >= len) {
prev = line;
continue;
}