justification: when leading whitespace exceeds fill width, wrap anyway

Pico wraps at the last blank character before or on the target column;
if there is no such blank, then it will wrap at the first blank *after*
the target column -- when it can wrap, it will wrap.  Nano should do
the same (and judging from the comments, it intended to do the same),
instead of turning the paragraph into a single unwrapped line.

This fixes https://savannah.gnu.org/bugs/?53986.
master
Benno Schulenberg 2018-05-27 10:24:02 +02:00
parent b9f533a69e
commit a832f33291
1 changed files with 2 additions and 2 deletions

View File

@ -1738,7 +1738,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
/* The length of the current character, in bytes. */
/* Find the last blank that does not overshoot the target column. */
while (*line != '\0' && column <= goal) {
while (*line != '\0' && ((ssize_t)column <= goal)) {
if (is_blank_mbchar(line) || (snap_at_nl && *line == '\n')) {
lastblank = index;
@ -1752,7 +1752,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
}
/* If the whole line displays shorter than goal, we're done. */
if (column <= goal)
if ((ssize_t)column <= goal)
return index;
#ifdef ENABLE_HELP