COLOR_LINE *ColorIndexList = NULL;
COLOR_LINE *ColorIndexSubjectList = NULL;
COLOR_LINE *ColorIndexAuthorList = NULL;
+COLOR_LINE *ColorIndexFlagsList = NULL;
/* local to this file */
static int ColorQuoteSize;
mutt_do_uncolor(buf, s, &ColorIndexSubjectList, &do_cache, parse_uncolor);
else if (object == MT_COLOR_INDEX_AUTHOR)
mutt_do_uncolor(buf, s, &ColorIndexAuthorList, &do_cache, parse_uncolor);
+ else if (object == MT_COLOR_INDEX_FLAGS)
+ mutt_do_uncolor(buf, s, &ColorIndexFlagsList, &do_cache, parse_uncolor);
if (do_cache && !option (OPTNOCURSES))
{
object == MT_COLOR_BODY ||
object == MT_COLOR_INDEX ||
object == MT_COLOR_INDEX_SUBJECT ||
- object == MT_COLOR_INDEX_AUTHOR)
+ object == MT_COLOR_INDEX_AUTHOR ||
+ object == MT_COLOR_INDEX_FLAGS)
{
if (!MoreArgs (s))
{
1, fg, bg, attr, err, 1);
set_option (OPTFORCEREDRAWINDEX);
}
+ else if (object == MT_COLOR_INDEX_FLAGS)
+ {
+ r = add_pattern (&ColorIndexFlagsList, buf->data,
+ 1, fg, bg, attr, err, 1);
+ set_option (OPTFORCEREDRAWINDEX);
+ }
else if (object == MT_COLOR_QUOTED)
{
if (q_level >= ColorQuoteSize)
<command>color</command>
<arg choice="plain">
-<option>index-object</option>
+<option><emphasis>index-object</emphasis></option>
</arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
<command>uncolor</command>
<group choice="req">
<arg choice="plain">
-<option>index-object</option>
+<option><emphasis>index-object</emphasis></option>
</arg>
<arg choice="plain">
<option>header</option>
<para>
<emphasis>header</emphasis> and <emphasis>body</emphasis> match
<emphasis>regexp</emphasis> in the header/body of a message,
-<emphasis>index</emphasis> matches <emphasis>pattern</emphasis> (see
-<xref linkend="patterns"/>) in the message index. Note that IMAP
+<emphasis>index-object</emphasis> can match <emphasis>pattern</emphasis>
+(see <xref linkend="patterns"/>) in the message index. Note that IMAP
server-side searches (=b, =B, =h) are not supported for color index
patterns.
</para>
<listitem><para>underline (highlighting underlined patterns in the body of messages)</para></listitem>
</itemizedlist>
+<para>
+<emphasis>index-object</emphasis> can be one of the following:
+</para>
+
+<itemizedlist>
+<listitem><para>index (default highlighting of the entire index line, uses <emphasis>pattern</emphasis>)</para></listitem>
+<listitem><para>index_date (the date field)</para></listitem>
+<listitem><para>index_flags (the message flags, %S %Z, uses <emphasis>pattern</emphasis>)</para></listitem>
+<listitem><para>index_number (the message number, %C)</para></listitem>
+<listitem><para>index_collapsed (the number of messages in a collapsed thread, %M)</para></listitem>
+<listitem><para>index_author (the author name, %A %a %F %L %n, uses <emphasis>pattern</emphasis>)</para></listitem>
+<listitem><para>index_subject (the subject, %s, uses <emphasis>pattern</emphasis>)</para></listitem>
+<listitem><para>index_size (the message size, %c %l)</para></listitem>
+<listitem><para>index_label (the message label, %y %Y)</para></listitem>
+<listitem><para>index_tags (the transformed message tags, %g)</para></listitem>
+<listitem><para>index_tag (an individual message tag, %G, uses <emphasis>pattern / tag name</emphasis>)</para></listitem>
+</itemizedlist>
+
<para>
<emphasis>foreground</emphasis> and <emphasis>background</emphasis> can
be one of the following:
<command>unmono</command>
<group choice="req">
<arg choice="plain">
-<option>index</option>
+<option><emphasis>index-object</emphasis></option>
</arg>
<arg choice="plain">
<option>header</option>
case 'A':
if(hdr->env->reply_to && hdr->env->reply_to->mailbox)
{
- mutt_format_s (dest, destlen, prefix, mutt_addr_for_display (hdr->env->reply_to));
+ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_AUTHOR);
+ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, mutt_addr_for_display (hdr->env->reply_to));
+ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
break;
}
/* fall through if 'A' returns nothing */
case 'a':
if(hdr->env->from && hdr->env->from->mailbox)
{
- mutt_format_s (dest, destlen, prefix, mutt_addr_for_display (hdr->env->from));
+ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_AUTHOR);
+ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, mutt_addr_for_display (hdr->env->from));
+ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
}
else
dest[0] = '\0';
break;
case 'n':
- mutt_format_s (dest, destlen, prefix, mutt_get_name (hdr->env->from));
+ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_AUTHOR);
+ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, mutt_get_name (hdr->env->from));
+ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
break;
case 'N':
/* FOO - this is probably unsafe, but we are not likely to have such
a short string passed into this routine */
- *dest = ch;
- *(dest + 1) = 0;
+ buf2[0] = ch;
+ buf2[1] = 0;
+ colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_FLAGS);
+ mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2);
+ add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
break;
case 't':
char* SearchBuffers[MENU_MAX];
-static int get_color(int index, int type) {
+static int get_color(int index, unsigned char *s) {
COLOR_LINE *color;
- HEADER *hdr = Context->hdrs[index];
+ HEADER *hdr = Context->hdrs[Context->v2r[index]];
+ int type = *s;
switch (type) {
case MT_COLOR_INDEX_SUBJECT:
case MT_COLOR_INDEX_AUTHOR:
color = ColorIndexAuthorList;
break;
+ case MT_COLOR_INDEX_FLAGS:
+ color = ColorIndexFlagsList;
+ break;
default:
return ColorDefs[type];
}
if (*s == MT_COLOR_INDEX)
attrset(attr);
else
- attron(get_color(index, *s));
+ {
+ if (get_color(index, s) == 0)
+ attron(attr);
+ else
+ attron(get_color(index, s));
+ }
}
s++;
n -= 2;
/* please no non-MT_COLOR_INDEX objects after this point */
MT_COLOR_INDEX,
MT_COLOR_INDEX_AUTHOR,
+ MT_COLOR_INDEX_FLAGS,
MT_COLOR_INDEX_SUBJECT,
- /* below only index coloring stuff that doesn't have a colorline! */
+ /* below here - only index coloring stuff that doesn't have a pattern */
MT_COLOR_INDEX_COLLAPSED,
MT_COLOR_INDEX_DATE,
- MT_COLOR_INDEX_FLAGS,
MT_COLOR_INDEX_LABEL,
MT_COLOR_INDEX_NUMBER,
MT_COLOR_INDEX_SIZE,
extern COLOR_LINE *ColorIndexList;
extern COLOR_LINE *ColorIndexSubjectList;
extern COLOR_LINE *ColorIndexAuthorList;
+extern COLOR_LINE *ColorIndexFlagsList;
void ci_init_color (void);
void ci_start_color (void);