*/
snprintf (AttachmentMarker, sizeof (AttachmentMarker),
"\033]9;%ld\a", (long) time (NULL));
-
+ snprintf (ProtectedHeaderMarker, sizeof (ProtectedHeaderMarker),
+ "\033]8;%ld\a", (long) time (NULL));
+
/* on one of the systems I use, getcwd() does not return the same prefix
as is listed in the passwd file */
if ((p = getenv ("HOME")))
#define state_putc(x,y) fputc(x,(y)->fpout)
void state_mark_attach (STATE *);
+void state_mark_protected_header (STATE *);
void state_attach_puts (const char *, STATE *);
void state_prefix_putc (char, STATE *);
int state_printf(STATE *, const char *, ...);
state_puts (AttachmentMarker, s);
}
+void state_mark_protected_header (STATE *s)
+{
+ if ((s->flags & MUTT_DISPLAY) && !mutt_strcmp (Pager, "builtin"))
+ state_puts (ProtectedHeaderMarker, s);
+}
+
void state_attach_puts (const char *t, STATE *s)
{
if (*t != '\n') state_mark_attach (s);
static int brailleLine = -1;
static int brailleCol = -1;
-static int check_attachment_marker (char *);
+static int check_attachment_marker (const char *);
+static int check_protected_header_marker (const char *);
/* Checks if buf matches the QuoteRegexp and doesn't match Smileys.
* pmatch, if non-null, is populated with the regexec match against
regmatch_t pmatch[1];
int found, offset, null_rx, i;
- if (n == 0 || ISHEADER (lineInfo[n-1].type))
+ if (n == 0 || ISHEADER (lineInfo[n-1].type) ||
+ (check_protected_header_marker (raw) == 0))
{
if (buf[0] == '\n') /* end of header */
{
return (*buf == 'm');
}
-static int check_attachment_marker (char *p)
+static int check_marker (const char *q, const char *p)
{
- char *q = AttachmentMarker;
-
for (;*p == *q && *q && *p && *q != '\a' && *p != '\a'; p++, q++)
;
return (int) (*p - *q);
}
+static int check_attachment_marker (const char *p)
+{
+ return check_marker (AttachmentMarker, p);
+}
+
+static int check_protected_header_marker (const char *p)
+{
+ return check_marker (ProtectedHeaderMarker, p);
+}
+
static int grok_ansi(unsigned char *buf, int pos, ansi_attr *a)
{
int x = pos;
while (*p++ != 'm') /* skip ANSI sequence */
;
}
- else if (*p == '\033' && *(p+1) == ']' && check_attachment_marker ((char *) p) == 0)
+ else if (*p == '\033' && *(p+1) == ']' &&
+ ((check_attachment_marker ((char *) p) == 0) ||
+ (check_protected_header_marker ((char *) p) == 0)))
{
dprint (2, (debugfile, "fill_buffer: Seen attachment marker.\n"));
while (*p++ != '\a') /* skip pseudo-ANSI sequence */
ch = grok_ansi (buf, ch+2, pa) + 1;
while (cnt-ch >= 2 && buf[ch] == '\033' && buf[ch+1] == ']' &&
- check_attachment_marker ((char *) buf+ch) == 0)
+ ((check_attachment_marker ((char *) buf+ch) == 0) ||
+ (check_protected_header_marker ((char *) buf+ch) == 0)))
{
while (buf[ch++] != '\a')
if (ch >= cnt)