commit a832f33291c56fe79588237d0b2bcf8f6eb4a67d
parent b9f533a69e571e84958fa69699427de6f6672547
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 27 May 2018 10:24:02 +0200
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.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -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