From 178605ea0185fdd716533b3d637b4c1c9d9270f5 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Mon, 5 Feb 2018 15:20:18 +1000 Subject: [PATCH] more attempts at improving word wrap --- src/www_msgs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/www_msgs.c b/src/www_msgs.c index 04df246..255f1d5 100644 --- a/src/www_msgs.c +++ b/src/www_msgs.c @@ -716,11 +716,17 @@ static char *www_wordwrap(char *content, int cutoff) { last_space = &ret[at]; } at++; + ret[at] = '\0'; } else { - ret[at++] = content[i]; + ret[at] = ' '; + last_space = &ret[at++]; + ret[at] = '\0'; } - ret[at] = '\0'; - if (content[i] == '\r') { + + if (content[i] == '\r' && content[i+1] == '\r') { + i+=2; + ret[at++] = '\r'; + ret[at] = '\0'; line_count = 0; last_space = NULL; } else if (line_count == cutoff) {