Commit 43301fe8 authored by Thomas Roessler's avatar Thomas Roessler

Updating to patch-0.94.4.vikas.collapse.3.

parent dd53cfef
......@@ -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;
......
......@@ -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
......
......@@ -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 },
......
......@@ -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,
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment