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)
}
}
- 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;
{
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);
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;
{
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;
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;
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 ? '!' :
return (src);
#undef NEW
+#undef OLD
}
void
{ "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 },
#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
{
OPTASKBCC,
OPTASKCC,
OPTATTACHSPLIT,
- OPTAUTOCOLLAPSE,
OPTAUTOEDIT,
OPTAUTOTAG,
OPTBEEP,
OPTBEEPNEW,
OPTCHECKNEW,
- OPTCOLLAPSENEW,
+ OPTCOLLAPSEUNREAD,
OPTCONFIRMAPPEND,
OPTCONFIRMCREATE,
OPTEDITHDRS,
OPTSUSPEND,
OPTTHOROUGHSRC,
OPTTILDE,
- OPTUNCOLLAPSEJUMPNEW,
+ OPTUNCOLLAPSEJUMP,
OPTUSE8BITMIME,
OPTUSEDOMAIN,
OPTUSEFROM,
#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)
{
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)
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;
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);
}
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;
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;
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);