From: Kevin McCarthy Date: Wed, 15 Nov 2017 22:53:19 +0000 (-0800) Subject: Fix $smart_wrap to not be disabled by whitespace-prefixed lines. (closes #3857) X-Git-Tag: mutt-1-10-rel~117 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3940ed40312470370a03f092a1c234b1ebe660e;p=mutt Fix $smart_wrap to not be disabled by whitespace-prefixed lines. (closes #3857) changeset:737102af74eb fixed a folded header display issue with $smart_wrap by disabling $smart_wrap for lines beginning with whitespace. Unfortunately, this turns off smart wrapping in the body of an email too, even when the line has other whitespace breaks in it. An earlier commit, changeset:125076e0fdfa added an infinite loop fix when MUTT_PAGER_NSKIP is set, by disabling the smart_wrap if the space backtracking went to the beginning of the line. That is, a line beginning with 1+ whitespace followed by a single long word. Extend this second commit by always disabling the smart_wrap in that case, not just when MUTT_PAGER_NSKIP is set. This also solves the folded header issue without other side effects. --- diff --git a/pager.c b/pager.c index 332bbbf8..c7712443 100644 --- a/pager.c +++ b/pager.c @@ -1464,15 +1464,19 @@ display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, { if (cnt < b_read) { - if (ch != -1 && buf[0] != ' ' && buf[0] != '\t' && + if (ch != -1 && buf[cnt] != ' ' && buf[cnt] != '\t' && buf[cnt] != '\n' && buf[cnt] != '\r') { buf_ptr = buf + ch; /* skip trailing blanks */ while (ch && (buf[ch] == ' ' || buf[ch] == '\t' || buf[ch] == '\r')) ch--; - /* a very long word with leading spaces causes infinite wrapping */ - if ((!ch) && (flags & MUTT_PAGER_NSKIP)) + /* A very long word with leading spaces causes infinite + * wrapping when MUTT_PAGER_NSKIP is set. A folded header + * with a single long word shouldn't be smartwrapped + * either. So just disable smart_wrap if it would wrap at the + * beginning of the line. */ + if (!ch) buf_ptr = buf + cnt; else cnt = ch + 1;