Re: Mangling subject lines in index
On 2006-06-30 13:42 +0200, Andre Majorel wrote:
> Here's what I did. In PCRE terms, the result of the %s
> conversion in $index_format is now s/.*\[.*?]\s*// (i.e.
> everything to the closing "]" is ommitted, including any
> trailing whitespace).
This version of the patch should be a little less broken.
--
André Majorel <URL:http://www.teaser.fr/~amajorel/>
Do not use this account for regular correspondence.
See the URL above for contact information.
diff -U5 -r mutt-1.5.11/hdrline.c mutt-1.5.11-nomltag/hdrline.c
--- mutt-1.5.11/hdrline.c 2005-02-12 19:53:35.000000000 +0100
+++ mutt-1.5.11-nomltag/hdrline.c 2006-07-01 09:06:40.000000000 +0200
@@ -540,24 +540,52 @@
optional = 0;
}
break;
case 's':
+ {
+ const char *s = hdr->env->subject; /* AYM 2006-06-30 */
+ if (s != NULL)
+ {
+ const char *s0 = s;
+ while (*s != '\0' && *s != '[')
+ s++;
+ if (*s == '[')
+ {
+ s++;
+ while (*s != '\0' && *s != ']')
+ {
+ s++;
+ }
+ if (*s == ']')
+ {
+ s++;
+ while (isspace (*s))
+ s++;
+ }
+ else
+ s = s0;
+ }
+ else
+ s = s0;
+ }
- if (flags & M_FORMAT_TREE && !hdr->collapsed)
- {
- if (flags & M_FORMAT_FORCESUBJ)
+ if (flags & M_FORMAT_TREE && !hdr->collapsed)
{
- mutt_format_s (dest, destlen, "", NONULL (hdr->env->subject));
- snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, dest);
- mutt_format_s_tree (dest, destlen, prefix, buf2);
+ if (flags & M_FORMAT_FORCESUBJ)
+ {
+ mutt_format_s (dest, destlen, "", NONULL (s));
+ snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, dest);
+ mutt_format_s_tree (dest, destlen, prefix, buf2);
+ }
+ else
+ mutt_format_s_tree (dest, destlen, prefix, hdr->tree);
}
else
- mutt_format_s_tree (dest, destlen, prefix, hdr->tree);
+ /* Normal path -- AYM 2006-06-30 */
+ mutt_format_s (dest, destlen, prefix, NONULL (s));
}
- else
- mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->subject));
break;
case 'S':
if (hdr->deleted)
ch = 'D';