From 9702041148834fa064de44cf89292f5b3bdc0560 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Wed, 15 Nov 2017 14:53:19 -0800 Subject: [PATCH] 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. --- pager.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pager.c b/pager.c index 7ecb0eebe..f2c0c1193 100644 --- a/pager.c +++ b/pager.c @@ -1569,8 +1569,12 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info, /* 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; -- 2.40.0