Prevent newlines from being needlessly appended (fixes #667)

That wrap_if_needed call would sometimes cause empty newlines
to appear under otherwise already well-wrapped blocks of text.

The idea is that whenever a new character is about to be appended,
the current line is checked for being too long with that character
included, and the character is only actually appended after the
wrapper makes sure that appending it won't overflow the line by
inserting a newline. This means that wrap_if_needed is only ever
called before pushing the current character to records, never
after, as was the case here.
This commit is contained in:
Tamás Bálint Misius 2019-08-02 16:56:18 +02:00
parent 7158a00f44
commit 0bdf7ad914
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -181,7 +181,6 @@ namespace ui
case '-':
case '!':
word_begins_at = -1; // reset word state
wrap_if_needed(line_width);
break;
}
}