The header folding algorithm outputs a word without spaces and longer
than $wrap as-is. The pager however tries to break it. With $smart_wrap
unset, it simply breaks at $wrap regardless if there's a space or
not. With $smart_wrap set it tried to find a space and break if the next
word is too long. This logic doesn't work for folded header lines which
always start with space. Thus, the output would always contain the
folding whitespace on a line by itself detaching the header value from
the header name.
As an intermediate fix we don't try to be smart if the line begins with
space or tab.
{
if (cnt < b_read)
{
- if (ch != -1 && buf[cnt] != ' ' && buf[cnt] != '\t' && buf[cnt] != '\n' && buf[cnt] != '\r')
+ if (ch != -1 && buf[0] != ' ' && buf[0] != '\t' &&
+ buf[cnt] != ' ' && buf[cnt] != '\t' && buf[cnt] != '\n' && buf[cnt] != '\r')
{
buf_ptr = buf + ch;
/* skip trailing blanks */