struct syntax_t *syntax;
struct syntax_t *search;
struct q_class_t *quote;
+ unsigned int is_cont_hdr; /* this line is a continuation of the previous header line */
};
#define ANSI_OFF (1<<0)
if (n == 0 || ISHEADER (lineInfo[n-1].type))
{
- if (buf[0] == '\n') {
+ if (buf[0] == '\n') /* end of header */
+ {
lineInfo[n].type = MT_COLOR_NORMAL;
getyx(stdscr, brailleLine, brailleCol);
- } else if (n > 0 && (buf[0] == ' ' || buf[0] == '\t'))
- {
- lineInfo[n].type = lineInfo[n-1].type; /* wrapped line */
- (lineInfo[n].syntax)[0].color = (lineInfo[n-1].syntax)[0].color;
}
else
{
- lineInfo[n].type = MT_COLOR_HDEFAULT;
- color_line = ColorHdrList;
- while (color_line)
+ /* if this is a continuation of the previous line, use the previous
+ * line's color as default. */
+ if (n > 0 && (buf[0] == ' ' || buf[0] == '\t'))
+ {
+ lineInfo[n].type = lineInfo[n-1].type; /* wrapped line */
+ (lineInfo[n].syntax)[0].color = (lineInfo[n-1].syntax)[0].color;
+ lineInfo[n].is_cont_hdr = 1;
+ }
+ else
+ {
+ lineInfo[n].type = MT_COLOR_HDEFAULT;
+ }
+
+ for (color_line = ColorHdrList; color_line; color_line = color_line->next)
{
if (REGEXEC (color_line->rx, buf) == 0)
{
lineInfo[n].type = MT_COLOR_HEADER;
lineInfo[n].syntax[0].color = color_line->pair;
+ if (lineInfo[n].is_cont_hdr)
+ {
+ /* adjust the previous continuation lines to reflect the color of this continuation line */
+ int j;
+ for (j = n - 1; j >= 0 && lineInfo[j].is_cont_hdr; --j)
+ {
+ lineInfo[j].type = lineInfo[n].type;
+ lineInfo[j].syntax[0].color = lineInfo[n].syntax[0].color;
+ }
+ /* now adjust the first line of this header field */
+ if (j >= 0)
+ {
+ lineInfo[j].type = lineInfo[n].type;
+ lineInfo[j].syntax[0].color = lineInfo[n].syntax[0].color;
+ }
+ *force_redraw = 1; /* the previous lines have already been drawn on the screen */
+ }
break;
}
- color_line = color_line->next;
}
}
}
{
if (*(p+1) == '_') /* underline */
p += 2;
- else if (*(p+1)) /* bold or overstrike */
+ else if (*(p+1) && q > *fmt) /* bold or overstrike */
{
*(q-1) = *(p+1);
p += 2;
int ch, vch, k, last_special = -1, special = 0, t;
wchar_t wc;
mbstate_t mbstate;
-
int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap);
-
+
+ if (check_attachment_marker ((char *)buf) == 0)
+ wrap_cols = COLS;
+
/* FIXME: this should come from lineInfo */
memset(&mbstate, 0, sizeof(mbstate));
{
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 */
{
regerror (err, &SearchRE, buffer, sizeof (buffer));
mutt_error ("%s", buffer);
- regfree (&SearchRE);
for (i = 0; i < maxLine ; i++)
{
/* cleanup */