justify: never break a line in leading whitespace
This fixes https://savannah.gnu.org/bugs/?57984. The bug was old -- it existed since at least version 2.0.6.master
parent
ebf9279f95
commit
01477d3b81
|
@ -1367,6 +1367,13 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
|
|||
int charlen = 0;
|
||||
/* The length of the current character, in bytes. */
|
||||
|
||||
/* Skip over leading whitespace, where a line should never be broken. */
|
||||
while (*line != '\0' && is_blank_mbchar(line)) {
|
||||
charlen = advance_over(line, &column);
|
||||
line += charlen;
|
||||
index += charlen;
|
||||
}
|
||||
|
||||
/* Find the last blank that does not overshoot the target column. */
|
||||
while (*line != '\0' && ((ssize_t)column <= goal)) {
|
||||
if (is_blank_mbchar(line))
|
||||
|
|
Loading…
Reference in New Issue