Mercurial > hg > mlmmj
changeset 835:ac0272a516f7
Don't count skipped text when reckoning line length for wrapping.
author | Ben Schmidt |
---|---|
date | Mon, 23 Jan 2012 18:03:37 +1100 |
parents | 7bb2c09d3abb |
children | 5ab7b62e8223 |
files | src/prepstdreply.c |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/prepstdreply.c Mon Jan 23 18:01:35 2012 +1100 +++ b/src/prepstdreply.c Mon Jan 23 18:03:37 2012 +1100 @@ -1049,12 +1049,17 @@ pos = line; } - incision = txt->skip != NULL ? pos - line : -1; + if (txt->skip != NULL) { + incision = pos - line; + len = incision; + } else { + incision = -1; + } spc = NULL; directive = 0; while (*pos != '\0') { if (txt->wrapwidth != 0 && len > txt->wrapwidth && - txt->skip == NULL && !peeking) break; + !peeking) break; if (*pos == '\r') { *pos = '\0'; pos++; @@ -1089,7 +1094,6 @@ directive = 1; swallow = handle_directive(txt, &line, &pos, peeking, listdir); - len = pos - line; spc = NULL; if (swallow == 1) peeking = 0; if (swallow == -1) break; @@ -1099,6 +1103,7 @@ * later */ incision = pos - line; } + len = incision; } else { if (incision != -1) { /* Time to cut */ @@ -1111,6 +1116,7 @@ } incision = -1; } + len = pos - line; } /* handle_directive() sets up for the next * character to process, so continue straight @@ -1119,7 +1125,7 @@ } else if (peeking && txt->skip == NULL) { break; } - len++; + if (txt->skip == NULL) len++; pos++; }