- %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,
}
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;
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 {