From: Ben Schmidt Date: Wed, 29 Feb 2012 06:39:28 +0000 (+1100) Subject: Allow whitespace-only lines to end wrapping. X-Git-Tag: RELEASE_1_2_18a1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fcc3966b5ebfbec6f853cfaf4527276b7d0d528;p=thirdparty%2Fmlmmj.git Allow whitespace-only lines to end wrapping. --- diff --git a/README.listtexts b/README.listtexts index 68717d11..f030a425 100644 --- a/README.listtexts +++ b/README.listtexts @@ -251,11 +251,12 @@ Wrapping needs to be enabled for each paragraph with: - %wrap% - %wrap W% - concatenate and rewrap lines until the next blank line to a width of W (or 76 - if W is omitted); second and later lines are preceded with as many spaces as - the width preceding the directive; the width is reckoned including any text - preceding the directive and any indentation preserved from a file which - included the current one, so it is an absolute maximum width + concatenate and rewrap lines until the next empty or whitespace-only line to + a width of W (or 76 if W is omitted); second and later lines are preceded + with as many spaces as the width preceding the directive; the width is + reckoned including any text preceding the directive and any indentation + preserved from a file which included the current one, so it is an absolute + maximum width To cater for various languages, there are a number of different wrapping modes that can be set. These can be set either before or after wrapping is specified, diff --git a/src/prepstdreply.c b/src/prepstdreply.c index 13a9517a..a5e2c70e 100644 --- a/src/prepstdreply.c +++ b/src/prepstdreply.c @@ -1207,9 +1207,11 @@ char *get_processed_text_line(text *txt, int headers, } pos++; *pos = '\0'; - if (*line == '\r' || *line == '\n' || *line == '\0') { - /* Blank line; stop wrapping, finish - the last line and save the blank + pos = line; + while (*pos == ' ' || *pos == '\t') pos++; + if (*pos == '\r' || *pos == '\n' || *pos == '\0') { + /* Empty/white line; stop wrapping, finish + the last line and save the empty/white line for later. */ txt->wrapwidth = 0; txt->src->upcoming = line; @@ -1219,12 +1221,6 @@ char *get_processed_text_line(text *txt, int headers, pos = line + len; skipwhite = 0; } else { - pos = line; - while (*pos == ' ' || *pos == '\t') pos++; - if (*pos == '\0') { - myfree(line); - continue; - } if (*prev == '\0') { tmp = mystrdup(pos); } else {