Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > 00439071878a5f05ae6865091f62cce0 > files > 3

mutt-1.5.21-3.2.mga1.src.rpm

diff --git a/color.c b/color.c
index bb6cbb4..c295dc4 100644
--- a/color.c
+++ b/color.c
@@ -35,6 +35,8 @@ int ColorDefs[MT_COLOR_MAX];
 COLOR_LINE *ColorHdrList = NULL;
 COLOR_LINE *ColorBodyList = NULL;
 COLOR_LINE *ColorIndexList = NULL;
+COLOR_LINE *ColorIndexSubjectList = NULL;
+COLOR_LINE *ColorIndexAuthorList = NULL;
 
 /* local to this file */
 static int ColorQuoteSize;
@@ -93,6 +95,14 @@ static struct mapping_t Fields[] =
   { "bold",		MT_COLOR_BOLD },
   { "underline",	MT_COLOR_UNDERLINE },
   { "index",		MT_COLOR_INDEX },
+  { "index_subject",	MT_COLOR_INDEX_SUBJECT },
+  { "index_author",	MT_COLOR_INDEX_AUTHOR },
+  { "index_collapsed",	MT_COLOR_INDEX_COLLAPSED },
+  { "index_date",	MT_COLOR_INDEX_DATE },
+  { "index_flags",	MT_COLOR_INDEX_FLAGS },
+  { "index_label",	MT_COLOR_INDEX_LABEL },
+  { "index_number",	MT_COLOR_INDEX_NUMBER },
+  { "index_size",	MT_COLOR_INDEX_SIZE },
   { "sidebar_new",	MT_COLOR_NEW },
   { "sidebar_flagged",	MT_COLOR_FLAGGED },
   { NULL,		0 }
@@ -366,11 +376,54 @@ int mutt_parse_unmono (BUFFER *buf, BUFFER *s, unsigned long data,
   return _mutt_parse_uncolor(buf, s, data, err, 0);
 }
 
+static void
+mutt_do_uncolor (BUFFER *buf, BUFFER *s, COLOR_LINE **ColorList, 
+    			int *do_cache, int parse_uncolor)
+{
+  COLOR_LINE *tmp, *last = NULL;
+
+  do
+  {
+    mutt_extract_token (buf, s, 0);
+    if (!mutt_strcmp ("*", buf->data))
+    {
+      for (tmp = *ColorList; tmp; )
+      {
+        if (!*do_cache)
+	  *do_cache = 1;
+	last = tmp;
+	tmp = tmp->next;
+	mutt_free_color_line(&last, parse_uncolor);
+      }
+      *ColorList = NULL;
+    }
+    else
+    {
+      for (last = NULL, tmp = *ColorList; tmp; last = tmp, tmp = tmp->next)
+      {
+	if (!mutt_strcmp (buf->data, tmp->pattern))
+	{
+          if (!*do_cache)
+	    *do_cache = 1;
+	  dprint(1,(debugfile,"Freeing pattern \"%s\" from ColorList\n",
+	                       tmp->pattern));
+	  if (last)
+	    last->next = tmp->next;
+	  else
+	    *ColorList = tmp->next;
+	  mutt_free_color_line(&tmp, parse_uncolor);
+	  break;
+	}
+      }
+    }
+  }
+  while (MoreArgs (s));
+}
+
 static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data,
 				BUFFER *err, short parse_uncolor)
 {
   int object = 0, do_cache = 0;
-  COLOR_LINE *tmp, *last = NULL;
   COLOR_LINE **list;
 
   mutt_extract_token (buf, s, 0);
@@ -381,6 +434,13 @@ static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data,
     return (-1);
   }
 
+  if (object > MT_COLOR_INDEX_AUTHOR) /* uncolor index column */
+  {
+    ColorDefs[object] = 0;
+    set_option (OPTFORCEREDRAWINDEX);
+    return (0);
+  }
+
   if (mutt_strncmp (buf->data, "index", 5) == 0)
     list = &ColorIndexList;
   else if (mutt_strncmp (buf->data, "body", 4) == 0)
@@ -424,43 +484,13 @@ static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data,
     return 0;
   }
 
-  do
-  {
-    mutt_extract_token (buf, s, 0);
-    if (!mutt_strcmp ("*", buf->data))
-    {
-      for (tmp = *list; tmp; )
-      {
-        if (!do_cache)
-	  do_cache = 1;
-	last = tmp;
-	tmp = tmp->next;
-	mutt_free_color_line(&last, parse_uncolor);
-      }
-      *list = NULL;
-    }
-    else
-    {
-      for (last = NULL, tmp = *list; tmp; last = tmp, tmp = tmp->next)
-      {
-	if (!mutt_strcmp (buf->data, tmp->pattern))
-	{
-          if (!do_cache)
-	    do_cache = 1;
-	  dprint(1,(debugfile,"Freeing pattern \"%s\" from color list\n",
-	                       tmp->pattern));
-	  if (last)
-	    last->next = tmp->next;
-	  else
-	    *list = tmp->next;
-	  mutt_free_color_line(&tmp, parse_uncolor);
-	  break;
-	}
-      }
-    }
-  }
-  while (MoreArgs (s));
 
+  if (object == MT_COLOR_INDEX)
+    mutt_do_uncolor(buf, s, &ColorIndexList, &do_cache, parse_uncolor);
+  if (object == MT_COLOR_INDEX_SUBJECT)
+    mutt_do_uncolor(buf, s, &ColorIndexSubjectList, &do_cache, parse_uncolor);
+  if (object == MT_COLOR_INDEX_AUTHOR)
+    mutt_do_uncolor(buf, s, &ColorIndexAuthorList, &do_cache, parse_uncolor);
 
   if (do_cache && !option (OPTNOCURSES))
   {
@@ -700,7 +730,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
 
   /* extract a regular expression if needed */
   
-  if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY || object == MT_COLOR_INDEX)
+  if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY || object == MT_COLOR_INDEX || object == MT_COLOR_INDEX_SUBJECT || object == MT_COLOR_INDEX_AUTHOR)
   {
     if (!MoreArgs (s))
     {
@@ -744,6 +774,18 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
     r = add_pattern (&ColorIndexList, buf->data, 1, fg, bg, attr, err, 1);
     set_option (OPTFORCEREDRAWINDEX);
   }
+  else if (object == MT_COLOR_INDEX_SUBJECT)
+  {
+    r = add_pattern (&ColorIndexSubjectList, buf->data,
+		     1, fg, bg, attr, err, 1);
+    set_option (OPTFORCEREDRAWINDEX);
+  }
+  else if (object == MT_COLOR_INDEX_AUTHOR)
+  {
+    r = add_pattern (&ColorIndexAuthorList, buf->data,
+		     1, fg, bg, attr, err, 1);
+    set_option (OPTFORCEREDRAWINDEX);
+  }
   else if (object == MT_COLOR_QUOTED)
   {
     if (q_level >= ColorQuoteSize)
@@ -769,7 +811,11 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
       ColorQuote[q_level] = fgbgattr_to_color(fg, bg, attr);
   }
   else
+  {
     ColorDefs[object] = fgbgattr_to_color(fg, bg, attr);
+    if (object > MT_COLOR_INDEX_AUTHOR)
+      set_option (OPTFORCEREDRAWINDEX);
+  }
 
 #ifdef HAVE_COLOR
 # ifdef HAVE_BKGDSET
diff --git a/curs_lib.c b/curs_lib.c
index 2427e60..dc01320 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -711,6 +711,7 @@ void mutt_format_string (char *dest, size_t destlen,
   size_t k, k2;
   char scratch[MB_LEN_MAX];
   mbstate_t mbstate1, mbstate2;
+  int escaped = 0;
 
   memset(&mbstate1, 0, sizeof (mbstate1));
   memset(&mbstate2, 0, sizeof (mbstate2));
@@ -726,7 +727,15 @@ void mutt_format_string (char *dest, size_t destlen,
       k = (k == (size_t)(-1)) ? 1 : n;
       wc = replacement_char ();
     }
-    if (arboreal && wc < M_TREE_MAX)
+    if (escaped) {
+      escaped = 0;
+      w = 0;
+    }
+    else if (arboreal && wc == M_SPECIAL_INDEX) {
+      escaped = 1;
+      w = 0;
+    }
+    else if (arboreal && wc < M_TREE_MAX)
       w = 1; /* hack */
     else
     {
diff --git a/doc/manual.xml.head b/doc/manual.xml.head
index 74c33da..b9dad0f 100644
--- a/doc/manual.xml.head
+++ b/doc/manual.xml.head
@@ -2470,7 +2470,7 @@ silently truncated at the screen width, and are not wrapped.
 
 <command>color</command>
 <arg choice="plain">
-<option>index</option>
+<option>index-object</option>
 </arg>
 <arg choice="plain">
 <replaceable class="parameter">foreground</replaceable>
@@ -2485,7 +2485,7 @@ silently truncated at the screen width, and are not wrapped.
 <command>uncolor</command>
 <group choice="req">
 <arg choice="plain">
-<option>index</option>
+<option>index-object</option>
 </arg>
 <arg choice="plain">
 <option>header</option>
@@ -2526,6 +2526,14 @@ in the header/body of a message, <emphasis>index</emphasis> matches <emphasis>pa
 <listitem><para>bold (hiliting bold patterns in the body of messages)</para></listitem>
 <listitem><para>error (error messages printed by Mutt)</para></listitem>
 <listitem><para>hdrdefault (default color of the message header in the pager)</para></listitem>
+<listitem><para>index_author (color of the author name in the index, uses <emphasis>pattern</emphasis>)</para></listitem>
+<listitem><para>index_collapsed (the number of messages in a collapsed thread in the index)</para></listitem>
+<listitem><para>index_date (color of the date field in the index)</para></listitem>
+<listitem><para>index_flags (color of the message flags in the index)</para></listitem>
+<listitem><para>index_label (color of the message label in the index)</para></listitem>
+<listitem><para>index_number (color of the message number in the index)</para></listitem>
+<listitem><para>index_size (color of the message size and line number in the index)</para></listitem>
+<listitem><para>index_subject (color of the subject in the index, uses <emphasis>pattern</emphasis>)</para></listitem>
 <listitem><para>indicator (arrow or bar used to indicate the current item in a menu)</para></listitem>
 <listitem><para>markers (the <quote>+</quote> markers at the beginning of wrapped lines in the pager)</para></listitem>
 <listitem><para>message (informational messages)</para></listitem>
diff --git a/hdrline.c b/hdrline.c
index 23f596e..effae17 100644
--- a/hdrline.c
+++ b/hdrline.c
@@ -103,6 +103,34 @@ static int first_mailing_list (char *buf, size_t buflen, ADDRESS *a)
   return 0;
 }
 
+/* Takes the color to embed, the buffer to manipulate and the buffer length as
+ * arguments.
+ * Returns the number of chars written. */
+static size_t add_index_color(char *buf, size_t buflen,
+    			   format_flag flags, char color)
+{
+  int len;
+
+  /* only add color markers if we are operating on main index entries. */
+  if (!(flags & M_FORMAT_INDEX))
+    return 0;
+
+  if (color == MT_COLOR_INDEX) { /* buf might be uninitialized other cases */
+    len = mutt_strlen(buf);
+    buf += len;
+    buflen -= len;
+  }
+
+  if (buflen < 2)
+    return 0;
+
+  buf[0] = M_SPECIAL_INDEX;
+  buf[1] = color;
+  buf[2] = '\0';
+
+  return 2;
+}
+
 static void make_from (ENVELOPE *hdr, char *buf, size_t len, int do_lists)
 {
   int me;
@@ -256,6 +284,7 @@ hdr_format_str (char *dest,
 #define THREAD_NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 1)
 #define THREAD_OLD (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 2)
   size_t len;
+  size_t colorlen;
 
   hdr = hfi->hdr;
   ctx = hfi->ctx;
@@ -307,12 +336,17 @@ hdr_format_str (char *dest,
       break;
     
     case 'c':
+      colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SIZE);
       mutt_pretty_size (buf2, sizeof (buf2), (long) hdr->content->length);
-      mutt_format_s (dest, destlen, prefix, buf2);
+      mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2);
+      add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
       break;
 
     case 'C':
-      snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
+      colorlen = add_index_color(fmt, sizeof(fmt), flags, MT_COLOR_INDEX_NUMBER);
+      snprintf (fmt+colorlen, sizeof(fmt)-colorlen, "%%%sd", prefix);
+      add_index_color(fmt+colorlen, sizeof(fmt)-colorlen, flags, MT_COLOR_INDEX);
+
       snprintf (dest, destlen, fmt, hdr->msgno + 1);
       break;
 
@@ -411,7 +445,10 @@ hdr_format_str (char *dest,
 	if (do_locales)
 	  setlocale (LC_TIME, "C");
 
-	mutt_format_s (dest, destlen, prefix, buf2);
+	colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_DATE);
+	mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2);
+	add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
+
 	if (len > 0 && op != 'd' && op != 'D') /* Skip ending op */
 	  src = cp + 1;
       }
@@ -441,8 +478,10 @@ hdr_format_str (char *dest,
     case 'F':
       if (!optional)
       {
+	colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_AUTHOR);
         make_from (hdr->env, buf2, sizeof (buf2), 0);
-	mutt_format_s (dest, destlen, prefix, buf2);
+	mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2);
+	add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
       }
       else if (mutt_addr_is_user (hdr->env->from))
         optional = 0;
@@ -474,7 +513,9 @@ hdr_format_str (char *dest,
       if (!optional)
       {
 	snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
-	snprintf (dest, destlen, fmt, (int) hdr->lines);
+	colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SIZE);
+	snprintf (dest+colorlen, destlen-colorlen, fmt, (int) hdr->lines);
+	add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
       }
       else if (hdr->lines <= 0)
         optional = 0;
@@ -483,8 +524,10 @@ hdr_format_str (char *dest,
     case 'L':
       if (!optional)
       {
+	colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_AUTHOR);
 	make_from (hdr->env, buf2, sizeof (buf2), 1);
-	mutt_format_s (dest, destlen, prefix, buf2);
+	mutt_format_s (dest+colorlen, destlen-colorlen, prefix, buf2);
+	add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
       }
       else if (!check_for_mailing_list (hdr->env->to, NULL, NULL, 0) &&
 	       !check_for_mailing_list (hdr->env->cc, NULL, NULL, 0))
@@ -539,10 +582,16 @@ hdr_format_str (char *dest,
       snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
       if (!optional)
       {
-	if (threads && is_index && hdr->collapsed && hdr->num_hidden > 1)
-	  snprintf (dest, destlen, fmt, hdr->num_hidden);
-	else if (is_index && threads)
-	  mutt_format_s (dest, destlen, prefix, " ");
+	colorlen = add_index_color(dest, destlen, flags, 
+				   MT_COLOR_INDEX_COLLAPSED);
+	if (threads && is_index && hdr->collapsed && hdr->num_hidden > 1) {
+	  snprintf (dest+colorlen, destlen-colorlen, fmt, hdr->num_hidden);
+	  add_index_color(dest, destlen-colorlen, flags, MT_COLOR_INDEX);
+	}
+	else if (is_index && threads) {
+	  mutt_format_s (dest+colorlen, destlen-colorlen, prefix, " ");
+	  add_index_color(dest, destlen-colorlen, flags, MT_COLOR_INDEX);
+	}
 	else
 	  *dest = '\0';
       }
@@ -572,15 +621,23 @@ hdr_format_str (char *dest,
       {
 	if (flags & M_FORMAT_FORCESUBJ)
 	{
-	  mutt_format_s (dest, destlen, "", NONULL (hdr->env->subject));
+	  colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SUBJECT);
+	  mutt_format_s (dest+colorlen, destlen-colorlen, "", 
+	      NONULL (hdr->env->subject));
+	  add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
+
 	  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 (dest, destlen, prefix, NONULL (hdr->env->subject));
+      else {
+	colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_SUBJECT);
+	mutt_format_s (dest+colorlen, destlen-colorlen, prefix, 
+	    NONULL (hdr->env->subject));
+	add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
+      }
       break;
 
     case 'S':
@@ -683,7 +740,9 @@ hdr_format_str (char *dest,
 		hdr->tagged ? '*' :
 		(hdr->flagged ? '!' :
 		 (Tochars && ((i = mutt_user_is_recipient (hdr)) < mutt_strlen (Tochars)) ? Tochars[i] : ' ')));
-      mutt_format_s (dest, destlen, prefix, buf2);
+      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 'X':
@@ -703,7 +762,9 @@ hdr_format_str (char *dest,
        if (optional)
 	 optional = hdr->env->x_label ? 1 : 0;
 
-       mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label));
+       colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_LABEL);
+       mutt_format_s (dest+colorlen, destlen-colorlen, prefix, NONULL (hdr->env->x_label));
+       add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
        break;
  
     case 'Y':
@@ -729,10 +790,12 @@ hdr_format_str (char *dest,
       if (optional)
 	optional = i;
 
+      colorlen = add_index_color(dest, destlen, flags, MT_COLOR_INDEX_LABEL);
       if (i)
-        mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label));
+        mutt_format_s (dest+colorlen, destlen-colorlen, prefix, NONULL (hdr->env->x_label));
       else
-        mutt_format_s (dest, destlen, prefix, "");
+        mutt_format_s (dest+colorlen, destlen-colorlen, prefix, "");
+      add_index_color(dest+colorlen, destlen-colorlen, flags, MT_COLOR_INDEX);
 
       break;
 
diff --git a/menu.c b/menu.c
index fa06915..672e5b2 100644
--- a/menu.c
+++ b/menu.c
@@ -35,7 +35,30 @@ extern size_t UngetCount;
 
 char* SearchBuffers[MENU_MAX];
 
-static void print_enriched_string (int attr, unsigned char *s, int do_color)
+static int get_color(int index, int type) {
+  COLOR_LINE *color;
+  HEADER *hdr = Context->hdrs[index];
+
+  switch (type) {
+    case MT_COLOR_INDEX_SUBJECT:
+      color = ColorIndexSubjectList;
+      break;
+    case MT_COLOR_INDEX_AUTHOR:
+      color = ColorIndexAuthorList;
+      break;
+    default:
+      return ColorDefs[type];
+  }
+
+  for (; color; color = color->next)
+    if (mutt_pattern_exec (color->color_pattern, M_MATCH_FULL_ADDRESS, 
+	Context, hdr))
+      return color->pair;
+
+  return 0;
+}
+
+static void print_enriched_string (int index, int attr, unsigned char *s, int do_color)
 {
   wchar_t wc;
   size_t k;
@@ -132,6 +155,18 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color)
       }
       if (do_color) attrset(attr);
     }
+    else if(*s == M_SPECIAL_INDEX)
+    {
+      s++;
+      if (do_color) {
+	if (*s == MT_COLOR_INDEX)
+	  attrset(attr);
+	else
+	  attron(get_color(index, *s));
+      }
+      s++; 
+      n -= 2;
+    }
     else if ((k = mbrtowc (&wc, (char *)s, n, &mbstate)) > 0)
     {
       addnstr ((char *)s, k);
@@ -235,7 +270,7 @@ void menu_redraw_index (MUTTMENU *menu)
 	  addstr ("   ");
 	}
 
-        print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
+        print_enriched_string (i, menu->color(i), (unsigned char *) buf, 1);
         SETCOLOR (MT_COLOR_NORMAL);          
       }
       else
@@ -249,7 +284,7 @@ void menu_redraw_index (MUTTMENU *menu)
 	}
 
 	CLEARLINE_WIN (i - menu->top + menu->offset);
-	print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
+	print_enriched_string (i, menu->color(i), (unsigned char *) buf, i != menu->current);
         SETCOLOR (MT_COLOR_NORMAL);
         BKGDSET (MT_COLOR_NORMAL);
       }
@@ -286,7 +321,7 @@ void menu_redraw_motion (MUTTMENU *menu)
       menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
       menu_pad_string (buf, sizeof (buf));
       move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3);
-      print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
+      print_enriched_string (menu->oldcurrent, menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
       SETCOLOR (MT_COLOR_NORMAL);
     }
 
@@ -304,7 +339,7 @@ void menu_redraw_motion (MUTTMENU *menu)
     clrtoeol ();
     menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
     menu_pad_string (buf, sizeof (buf));
-    print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
+    print_enriched_string (menu->oldcurrent, menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
 
     /* now draw the new one to reflect the change */
     menu_make_entry (buf, sizeof (buf), menu, menu->current);
@@ -313,7 +348,7 @@ void menu_redraw_motion (MUTTMENU *menu)
     ADDCOLOR (MT_COLOR_INDICATOR);
     BKGDSET (MT_COLOR_INDICATOR);
     CLEARLINE_WIN (menu->current - menu->top + menu->offset);
-    print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
+    print_enriched_string (menu->current, menu->color(menu->current), (unsigned char *) buf, 0);
     SETCOLOR (MT_COLOR_NORMAL);
     BKGDSET (MT_COLOR_NORMAL);
   }
@@ -339,7 +374,7 @@ void menu_redraw_current (MUTTMENU *menu)
     attrset (attr);
     addch (' ');
     menu_pad_string (buf, sizeof (buf));
-    print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1);
+    print_enriched_string (menu->current, menu->color(menu->current), (unsigned char *) buf, 1);
     SETCOLOR (MT_COLOR_NORMAL);
   }
   else
@@ -348,7 +383,7 @@ void menu_redraw_current (MUTTMENU *menu)
     ADDCOLOR (MT_COLOR_INDICATOR);
     BKGDSET (MT_COLOR_INDICATOR);
     clrtoeol ();
-    print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
+    print_enriched_string (menu->current, menu->color(menu->current), (unsigned char *) buf, 0);
     SETCOLOR (MT_COLOR_NORMAL);
     BKGDSET (MT_COLOR_NORMAL);
   }
diff --git a/mutt.h b/mutt.h
index 755a434..787b398 100644
--- a/mutt.h
+++ b/mutt.h
@@ -168,6 +168,8 @@ typedef enum
 #define M_TREE_MISSING		13
 #define M_TREE_MAX		14
 
+#define M_SPECIAL_INDEX		M_TREE_MAX
+
 #define M_THREAD_COLLAPSE	(1<<0)
 #define M_THREAD_UNCOLLAPSE	(1<<1)
 #define M_THREAD_GET_HIDDEN	(1<<2)
diff --git a/mutt_curses.h b/mutt_curses.h
index 5f61048..ed886b4 100644
--- a/mutt_curses.h
+++ b/mutt_curses.h
@@ -129,6 +129,16 @@ enum
   MT_COLOR_INDEX,
   MT_COLOR_NEW,
   MT_COLOR_FLAGGED,
+  /* please no non-MT_COLOR_INDEX objects after this point */
+  MT_COLOR_INDEX_SUBJECT,
+  MT_COLOR_INDEX_AUTHOR,
+  /* below only index coloring stuff that doesn't have a colorline! */
+  MT_COLOR_INDEX_COLLAPSED,
+  MT_COLOR_INDEX_DATE,
+  MT_COLOR_INDEX_FLAGS,
+  MT_COLOR_INDEX_LABEL,
+  MT_COLOR_INDEX_NUMBER,
+  MT_COLOR_INDEX_SIZE,
   MT_COLOR_MAX
 };
 
@@ -182,6 +192,8 @@ extern int ColorDefs[];
 extern COLOR_LINE *ColorHdrList;
 extern COLOR_LINE *ColorBodyList;
 extern COLOR_LINE *ColorIndexList;
+extern COLOR_LINE *ColorIndexSubjectList;
+extern COLOR_LINE *ColorIndexAuthorList;
 
 void ci_init_color (void);
 void ci_start_color (void);