From: Thomas Roessler Date: Wed, 13 Feb 2002 11:33:16 +0000 (+0000) Subject: Change the default format to be more friendly to "0-line messages", X-Git-Tag: mutt-1-5-1-rel~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6b9b97e58c83752fd388480a970e581aa3c0802;p=mutt Change the default format to be more friendly to "0-line messages", and fix optional expansion for %l - it was the wrong way around. Also, add a hack to parse.c so we ignore negative values in Lines headers. --- diff --git a/hdrline.c b/hdrline.c index 619d57cf..19621137 100644 --- a/hdrline.c +++ b/hdrline.c @@ -449,11 +449,8 @@ hdr_format_str (char *dest, snprintf (fmt, sizeof (fmt), "%%%sd", prefix); snprintf (dest, destlen, fmt, (int) hdr->lines); } - else - { - if (hdr->lines > 0) - optional = 0; - } + else if (hdr->lines <= 0) + optional = 0; break; case 'L': @@ -491,7 +488,7 @@ hdr_format_str (char *dest, } else { - if (hdr->score > 0) + if (hdr->score == 0) optional = 0; } break; diff --git a/init.h b/init.h index 0755d537..e4f85605 100644 --- a/init.h +++ b/init.h @@ -828,7 +828,7 @@ struct option_t MuttVars[] = { { "indent_str", DT_SYN, R_NONE, UL "indent_string", 0 }, /* */ - { "index_format", DT_STR, R_BOTH, UL &HdrFmt, UL "%4C %Z %{%b %d} %-15.15L (%4l) %s" }, + { "index_format", DT_STR, R_BOTH, UL &HdrFmt, UL "%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %s" }, /* ** .pp ** This variable allows you to customize the message index display to @@ -853,7 +853,8 @@ struct option_t MuttVars[] = { ** .dt %f .dd entire From: line (address + real name) ** .dt %F .dd author name, or recipient name if the message is from you ** .dt %i .dd message-id of the current message - ** .dt %l .dd number of lines in the message + ** .dt %l .dd number of lines in the message (does not work with maildir, + ** mh, and possibly IMAP folders) ** .dt %L .dd If an address in the To or CC header field matches an address ** defined by the users ``lists'' command, this displays ** "To ", otherwise the same as %F. diff --git a/parse.c b/parse.c index 2cf48392..d3ff9233 100644 --- a/parse.c +++ b/parse.c @@ -1065,6 +1065,14 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short { if (hdr) hdr->lines = atoi (p); + + /* + * HACK - mutt has, for a very short time, produced negative + * Lines header values. Ignore them. + */ + if (hdr->lines < 0) + hdr->lines = 0; + matched = 1; } break;