mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-10-31 13:08:40 +00:00
EMAIL: Fixed off by one bug in word_wrap_line()
This commit is contained in:
parent
d2567e8ac1
commit
32a6de5229
@ -796,14 +796,13 @@ uint8_t word_wrap_line(FILE *fp, char **s, uint8_t cols, char mode) {
|
||||
return (*s ? 1 : 0); // Caller should invoke again
|
||||
}
|
||||
i = cols - col; // Doesn't fit, need to break
|
||||
if (i > l)
|
||||
i = l;
|
||||
while ((ss[--i] != ' ') && (i > 0));
|
||||
if (i == 0) { // No space character found
|
||||
if (col == 0) // Doesn't fit on full line
|
||||
for (i = 0; i < cols; ++i) { // Truncate @cols chars
|
||||
if (col == 0) { // Doesn't fit on full line
|
||||
for (i = 0; i <= cols; ++i) { // Truncate @cols chars
|
||||
fputc(ss[i], fp);
|
||||
*s = ss + l + 1;
|
||||
}
|
||||
} else { // There is stuff on this line already
|
||||
col = 0;
|
||||
fputc('\r', fp); // Try a blank line
|
||||
|
Loading…
Reference in New Issue
Block a user