From f5e472b13a98fb84173e058fed462d3109508bb0 Mon Sep 17 00:00:00 2001 From: Rocco Rutte Date: Mon, 15 Jun 2009 16:28:03 +0200 Subject: [PATCH] pager: intermediate fix for wrapping long header lines with $smart_wrap set 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. --- pager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pager.c b/pager.c index 4b0cd71c1..bd82eb680 100644 --- a/pager.c +++ b/pager.c @@ -1383,7 +1383,8 @@ display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, { 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 */ -- 2.40.0