<<< Date Index >>>     <<< Thread Index >>>

"current" bar coloring



Hi,

here is a tiny patch, that really makes my life easier, may be someone
else thinks the same :)

The problem I was having, is that the selection bar that shows the current
message in an index, can only be of one color, which is defined by the
configuration. I made it to be inversed color of the current item. Oterwise, I
always have to move from the current message and back to see how it was
highlighted.

I remember I was cautios sending these out before, but that was long time
ago, and I don't remember exactly why, most probably because I had 
'|A_REVERSE' instead of '^A_REVERSE'...

Attached patches for 1.4.2.1 and 1.5.6

It this is liked, and can go into 1.5.7, then great ! :)

Thanks,
    Pawel.

Bye.
--
 Pawel S. Veselov [vps], Sun Microsystems, Inc.
 Staff Engineer, Java Mobile Systems and Services Engineering __ __(O) _ __
   (408) 276-5410   e-mail: Pawel.Veselov@xxxxxxx             \ V /| || '  \
fax(408) 276-6090 HomePage: http://manticore.2y.net            \_/ |_||_|_|_|

diff -ur mutt-1.4.2.1.old/menu.c mutt-1.4.2.1/menu.c
--- mutt-1.4.2.1.old/menu.c     Wed Jan 26 10:26:24 2005
+++ mutt-1.4.2.1/menu.c Wed Jan 26 10:39:12 2005
@@ -228,16 +228,14 @@
       }
       else
       {
+        int attrs = menu->color(i);
        if (i == menu->current)
-       {
-         SETCOLOR (MT_COLOR_INDICATOR);
-         BKGDSET (MT_COLOR_INDICATOR);
-       }
-        else
-          attrset (menu->color (i));
-            
+          attrs ^= A_REVERSE;
+
+        attrset(attrs);
+
        CLEARLINE (i - menu->top + menu->offset);
-       print_enriched_string (menu->color(i), (unsigned char *) buf, i != 
menu->current);
+        print_enriched_string(attrs, (unsigned char*)buf, 1);
         SETCOLOR (MT_COLOR_NORMAL);
         BKGDSET (MT_COLOR_NORMAL);
       }
@@ -296,10 +294,10 @@
     /* now draw the new one to reflect the change */
     menu_make_entry (buf, sizeof (buf), menu, menu->current);
     menu_pad_string (buf, sizeof (buf));
-    SETCOLOR (MT_COLOR_INDICATOR);
-    BKGDSET (MT_COLOR_INDICATOR);
+    attrset(menu->color(menu->current)^A_REVERSE);
     CLEARLINE (menu->current - menu->top + menu->offset);
-    print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 
0);
+    print_enriched_string(menu->color(menu->current)^A_REVERSE,
+            (unsigned char*)buf, 1);
     SETCOLOR (MT_COLOR_NORMAL);
     BKGDSET (MT_COLOR_NORMAL);
   }
@@ -329,10 +327,10 @@
   }
   else
   {
-    SETCOLOR (MT_COLOR_INDICATOR);
-    BKGDSET (MT_COLOR_INDICATOR);
+    int attr = menu->color(menu->current)^A_REVERSE;
+    attrset(attr);
     clrtoeol ();
-    print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 
0);
+    print_enriched_string(attr, (unsigned char*)buf, 1);
     SETCOLOR (MT_COLOR_NORMAL);
     BKGDSET (MT_COLOR_NORMAL);
   }
diff -ur mutt-1.5.6/menu.c mutt-1.5.6.pawel/menu.c
--- mutt-1.5.6/menu.c   Wed Jan 26 10:54:20 2005
+++ mutt-1.5.6.pawel/menu.c     Wed Jan 26 11:02:07 2005
@@ -237,16 +237,15 @@
       }
       else
       {
-        attrset (menu->color (i));
-            
+
+        int attrs = menu->color(i);
+
        if (i == menu->current)
-       {
-         ADDCOLOR (MT_COLOR_INDICATOR);
-         BKGDSET (MT_COLOR_INDICATOR);
-       }
+          attrs ^= A_REVERSE;
+        attrset (attrs);
 
        CLEARLINE (i - menu->top + menu->offset);
-       print_enriched_string (menu->color(i), (unsigned char *) buf, i != 
menu->current);
+        print_enriched_string (attrs, (unsigned char*)buf, 1);
         SETCOLOR (MT_COLOR_NORMAL);
         BKGDSET (MT_COLOR_NORMAL);
       }
@@ -307,10 +306,10 @@
     menu_make_entry (buf, sizeof (buf), menu, menu->current);
     menu_pad_string (buf, sizeof (buf));
     attrset (menu->color (menu->current));
-    ADDCOLOR (MT_COLOR_INDICATOR);
-    BKGDSET (MT_COLOR_INDICATOR);
+    attrset(menu->color(menu->current)^A_REVERSE);
     CLEARLINE (menu->current - menu->top + menu->offset);
-    print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 
0);
+    print_enriched_string(menu->color(menu->current)^A_REVERSE,
+            (unsigned char*)buf, 1);
     SETCOLOR (MT_COLOR_NORMAL);
     BKGDSET (MT_COLOR_NORMAL);
   }
@@ -341,11 +340,10 @@
   }
   else
   {
-    attrset (menu->color (menu->current));
-    ADDCOLOR (MT_COLOR_INDICATOR);
-    BKGDSET (MT_COLOR_INDICATOR);
+    int attr = menu->color(menu->current) ^ A_REVERSE;
+    attrset(attr);
     clrtoeol ();
-    print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 
0);
+    print_enriched_string (attr, (unsigned char *) buf, 1);
     SETCOLOR (MT_COLOR_NORMAL);
     BKGDSET (MT_COLOR_NORMAL);
   }