Mercurial > hg > mlmmj
changeset 858:cefb04b9f9bc
Allow whitespace-only lines to end wrapping.
author | Ben Schmidt |
---|---|
date | Wed, 29 Feb 2012 17:39:28 +1100 |
parents | aaedbc351b38 |
children | 18fa95bcf19c |
files | README.listtexts src/prepstdreply.c |
diffstat | 2 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/README.listtexts Wed Feb 29 01:04:11 2012 +1100 +++ b/README.listtexts Wed Feb 29 17:39:28 2012 +1100 @@ -251,11 +251,12 @@ - %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,
--- a/src/prepstdreply.c Wed Feb 29 01:04:11 2012 +1100 +++ b/src/prepstdreply.c Wed Feb 29 17:39:28 2012 +1100 @@ -1207,9 +1207,11 @@ } 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 @@ 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 {