]> granicus.if.org Git - neomutt/commitdiff
Updating to patch-0.94.4.vikas.collapse.3.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 31 Aug 1998 13:40:07 +0000 (13:40 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 31 Aug 1998 13:40:07 +0000 (13:40 +0000)
curs_main.c
hdrline.c
init.h
mutt.h
protos.h
thread.c

index 1b6b9050bb8b0d857a52de264880bf7555a5932b..0f69764b1044660ec1cae4973807ed5c52e623a8 100644 (file)
@@ -929,12 +929,13 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
          toggle_option (OPTWEED);
 
        unset_option (OPTNEEDRESORT);
+
        if ((Sort & SORT_MASK) == SORT_THREADS && CURHDR->collapsed)
        {
          mutt_uncollapse_thread (Context, CURHDR);
          mutt_set_virtual (Context);
-         if (option (OPTUNCOLLAPSEJUMPNEW))
-           menu->current = mutt_thread_next_new (Context, CURHDR);
+         if (option (OPTUNCOLLAPSEJUMP))
+           menu->current = mutt_thread_next_unread (Context, CURHDR);
        }
  
        if ((op = mutt_display_message (CURHDR, attach_msg_status)) == -1)
@@ -1119,11 +1120,17 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
            }
          }
 
-         if ((!CUR->deleted && !CUR->read) ||
-             (CUR->collapsed && !CUR->deleted && UNREAD (CUR)))
+         if (CUR->collapsed)
+         {
+           if (op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD || UNREAD(CUR) == 1)
+           {
+             menu->current = i;
+             break;
+           }
+         }
+         else if ((!CUR->deleted && !CUR->read))
          {
-           if (op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD ||
-               !CUR->old)
+           if (op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD || !CUR->old)
            {
              menu->current = i;
              break;
@@ -1290,10 +1297,10 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
        {
          menu->current = mutt_uncollapse_thread (Context, CURHDR);
          mutt_set_virtual (Context);
-         if (option (OPTUNCOLLAPSEJUMPNEW))
-           menu->current = mutt_thread_next_new (Context, CURHDR);
+         if (option (OPTUNCOLLAPSEJUMP))
+           menu->current = mutt_thread_next_unread (Context, CURHDR);
        }
-       else if (option (OPTCOLLAPSENEW) || !UNREAD (CURHDR))
+       else if (option (OPTCOLLAPSEUNREAD) || !UNREAD (CURHDR))
        {
          menu->current = mutt_collapse_thread (Context, CURHDR);
          mutt_set_virtual (Context);
@@ -1323,7 +1330,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
          
          if (CURHDR->collapsed)
            final = mutt_uncollapse_thread (Context, CURHDR);
-         else if (option (OPTCOLLAPSENEW) || !UNREAD (CURHDR))
+         else if (option (OPTCOLLAPSEUNREAD) || !UNREAD (CURHDR))
            final = mutt_collapse_thread (Context, CURHDR);
          else
            final = CURHDR->virtual;
@@ -1338,7 +1345,7 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
            {
              if (h->collapsed)
                mutt_uncollapse_thread (Context, h);
-             else if (option (OPTCOLLAPSENEW) || !UNREAD (h))
+             else if (option (OPTCOLLAPSEUNREAD) || !UNREAD (h))
                mutt_collapse_thread (Context, h);
            }
            h = h->next;
index c5b5fd6a7b7d70fde40bb9f284df339a590f9f78..822ea63331a8b921a89670ad6ce2a0560cd1925a 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -226,7 +226,8 @@ hdr_format_str (char *dest,
   int optional = (flags & M_FORMAT_OPTIONAL);
   int threads = ((Sort & SORT_MASK) == SORT_THREADS);
   int is_index = (flags & M_FORMAT_INDEX);
-#define NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr))
+#define NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 1)
+#define OLD (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 2)
   size_t len;
 
   hdr = hfi->hdr;
@@ -545,9 +546,9 @@ hdr_format_str (char *dest,
        ch = ' ';
       snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
       snprintf (buf2, sizeof (buf2),
-               "%c%c%c",
-               (hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno))
-               ? (NEW ? 'n' : (hdr->replied ? 'r' : ' ')) : (hdr->old ? 'O' : (NEW ? 'n' : 'N')),
+               "%c%c%c", (NEW ? 'n' : (OLD ? 'o' : 
+               ((hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno))
+               ? (hdr->replied ? 'r' : ' ') : (hdr->old ? 'O' : 'N')))),
                hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch),
                hdr->tagged ? '*' :
                (hdr->flagged ? '!' :
@@ -567,6 +568,7 @@ hdr_format_str (char *dest,
 
   return (src);
 #undef NEW
+#undef OLD
 }
 
 void
diff --git a/init.h b/init.h
index 0ffadfe6053418c94140fcf689f38bf785e7177d..3775f3f18d9da29a2407af13c81ffdf8a039b808 100644 (file)
--- a/init.h
+++ b/init.h
@@ -87,9 +87,8 @@ struct option_t MuttVars[] = {
   { "beep_new",                DT_BOOL, R_NONE, OPTBEEPNEW, 0 },
   { "charset",         DT_STR,  R_NONE, UL &Charset, UL "iso-8859-1" },
   { "check_new",       DT_BOOL, R_NONE, OPTCHECKNEW, 1 },
-  { "collapse_new",    DT_BOOL, R_NONE, OPTCOLLAPSENEW, 1 },
-  { "uncollapse_jump_new", DT_BOOL, R_NONE, OPTUNCOLLAPSEJUMPNEW, 0 },
-  { "auto_collapse",   DT_BOOL, R_NONE, OPTAUTOCOLLAPSE, 0 },
+  { "collapse_unread", DT_BOOL, R_NONE, OPTCOLLAPSEUNREAD, 1 },
+  { "uncollapse_jump",         DT_BOOL, R_NONE, OPTUNCOLLAPSEJUMP, 0 },
   { "confirmappend",   DT_BOOL, R_NONE, OPTCONFIRMAPPEND, 1 },
   { "confirmcreate",   DT_BOOL, R_NONE, OPTCONFIRMCREATE, 1 },
   { "copy",            DT_QUAD, R_NONE, OPT_COPY, M_YES },
diff --git a/mutt.h b/mutt.h
index 96160306098123af120240c33d23e23f926b67f0..565fdde17aa2b2abec5607ff4b1437f530f2e738 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -128,7 +128,7 @@ typedef enum
 #define M_THREAD_UNCOLLAPSE    (1<<1)
 #define M_THREAD_GET_HIDDEN    (1<<2)
 #define M_THREAD_UNREAD                (1<<3)
-#define M_THREAD_NEXT_NEW      (1<<4)
+#define M_THREAD_NEXT_UNREAD   (1<<4)
 
 enum
 {
@@ -243,13 +243,12 @@ enum
   OPTASKBCC,
   OPTASKCC,
   OPTATTACHSPLIT,
-  OPTAUTOCOLLAPSE,
   OPTAUTOEDIT,
   OPTAUTOTAG,
   OPTBEEP,
   OPTBEEPNEW,
   OPTCHECKNEW,
-  OPTCOLLAPSENEW,
+  OPTCOLLAPSEUNREAD,
   OPTCONFIRMAPPEND,
   OPTCONFIRMCREATE,
   OPTEDITHDRS,
@@ -289,7 +288,7 @@ enum
   OPTSUSPEND,
   OPTTHOROUGHSRC,
   OPTTILDE,
-  OPTUNCOLLAPSEJUMPNEW,
+  OPTUNCOLLAPSEJUMP,
   OPTUSE8BITMIME,
   OPTUSEDOMAIN,
   OPTUSEFROM,
index 159f5de684d9d78b07fbc65da27a45e66d83983c..b349dca420086de59a5d85f07b1c6db1d174832f 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -50,7 +50,7 @@ int _mutt_aside_thread (HEADER *, short, short);
 #define mutt_uncollapse_thread(x,y) _mutt_traverse_thread (x,y,M_THREAD_UNCOLLAPSE)
 #define mutt_get_hidden(x,y)_mutt_traverse_thread (x,y,M_THREAD_GET_HIDDEN) 
 #define mutt_thread_contains_unread(x,y) _mutt_traverse_thread (x,y,M_THREAD_UNREAD)
-#define mutt_thread_next_new(x,y) _mutt_traverse_thread(x,y,M_THREAD_NEXT_NEW)
+#define mutt_thread_next_unread(x,y) _mutt_traverse_thread(x,y,M_THREAD_NEXT_UNREAD)
 int _mutt_traverse_thread (CONTEXT *ctx, HEADER *hdr, int flag);
 
 #define ISSPACE(c) isspace((unsigned char)c)
index 916e2e0a8a406ecfb330783609c0cabf1cc97f57..d22b59384c41361dded27ce75a39d65c0c7e1207 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -699,7 +699,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
 {
   HEADER *roothdr = NULL, *top;
   int final, reverse = (Sort & SORT_REVERSE), minmsgno;
-  int num_hidden = 0, unread = 0;
+  int num_hidden = 0, new = 0, old = 0;
   int min_unread_msgno = INT_MAX, min_unread = cur->virtual;
 #define CHECK_LIMIT (!ctx->pattern || cur->limited)
 
@@ -718,7 +718,10 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
 
   if (!cur->read && CHECK_LIMIT)
   {
-    unread = 1;
+    if (cur->old)
+      old = 2;
+    else
+      new = 1;
     if (cur->msgno < min_unread_msgno)
     {
       min_unread = cur->virtual;
@@ -746,10 +749,10 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
     if (flag & (M_THREAD_COLLAPSE | M_THREAD_UNCOLLAPSE))
       return (final);
     else if (flag & M_THREAD_UNREAD)
-      return (unread);
+      return ((old && new) ? new : (old ? old : new));
     else if (flag & M_THREAD_GET_HIDDEN)
       return (num_hidden);
-    else if (flag & M_THREAD_NEXT_NEW)
+    else if (flag & M_THREAD_NEXT_UNREAD)
       return (min_unread);
   }
   
@@ -765,8 +768,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
          final = roothdr->virtual;
       }
 
-      if (reverse && (flag & M_THREAD_COLLAPSE) && (cur->msgno < minmsgno) 
-         && CHECK_LIMIT)
+      if (reverse && (flag & M_THREAD_COLLAPSE) && (cur->msgno < minmsgno) && CHECK_LIMIT)
       {
        minmsgno = cur->msgno;
        final = cur->virtual;
@@ -787,7 +789,10 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
 
     if (!cur->read && CHECK_LIMIT)
     {
-      unread = 1;
+      if (cur->old)
+       old = 2;
+      else
+       new = 1;
       if (cur->msgno < min_unread_msgno)
       {
        min_unread = cur->virtual;
@@ -824,10 +829,10 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
   if (flag & (M_THREAD_COLLAPSE | M_THREAD_UNCOLLAPSE))
     return (final);
   else if (flag & M_THREAD_UNREAD)
-    return (unread);
+    return ((old && new) ? new : (old ? old : new));
   else if (flag & M_THREAD_GET_HIDDEN)
     return (num_hidden+1);
-  else if (flag & M_THREAD_NEXT_NEW)
+  else if (flag & M_THREAD_NEXT_UNREAD)
     return (min_unread);
 
   return (0);