Commit eff7a49e authored by Thomas Roessler's avatar Thomas Roessler

Threading fix from Daniel Eisenbud.

parent 84a148e1
......@@ -82,8 +82,8 @@ extern const char *ReleaseDate;
void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num)
{
format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR;
int reverse = Sort & SORT_REVERSE, edgemsgno;
format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX;
int edgemsgno, reverse = Sort & SORT_REVERSE;
HEADER *tmp, *h = Context->hdrs[Context->v2r[num]];
if ((Sort & SORT_MASK) == SORT_THREADS && h->tree)
......@@ -96,18 +96,19 @@ void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num)
{
if (reverse)
{
if (menu->top + menu->pagelen > menu->max)
edgemsgno = Context->v2r[menu->max - 1];
else
edgemsgno = Context->v2r[menu->top + menu->pagelen - 1];
if (menu->top + menu->pagelen > menu->max)
edgemsgno = Context->v2r[menu->max - 1];
else
edgemsgno = Context->v2r[menu->top + menu->pagelen - 1];
}
else
edgemsgno = Context->v2r[menu->top];
edgemsgno = Context->v2r[menu->top];
for (tmp = h->parent; tmp; tmp = tmp->parent)
{
if ((reverse && tmp->msgno > edgemsgno)
|| (!reverse && tmp->msgno < edgemsgno))
/* if no ancestor is visible on current screen, provisionally force
* subject... */
if (reverse ? tmp->msgno > edgemsgno : tmp->msgno < edgemsgno)
{
flag |= M_FORMAT_FORCESUBJ;
break;
......@@ -119,8 +120,8 @@ void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num)
{
for (tmp = h->prev; tmp; tmp = tmp->prev)
{
if ((reverse && tmp->msgno > edgemsgno)
|| (!reverse && tmp->msgno < edgemsgno))
/* ...but if a previous sibling is available, don't force it */
if (reverse ? tmp->msgno > edgemsgno : tmp->msgno < edgemsgno)
break;
else if (tmp->virtual >= 0)
{
......@@ -132,7 +133,7 @@ void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num)
}
}
_mutt_make_string (s, l, NONULL (HdrFmt), Context, h, flag | M_FORMAT_INDEX);
_mutt_make_string (s, l, NONULL (HdrFmt), Context, h, flag);
}
int index_color (int index_no)
......
......@@ -48,18 +48,25 @@ static int need_display_subject (CONTEXT *ctx, HEADER *tree)
{
HEADER *tmp;
/* if our subject is different from our parent's, display it */
if (tree->subject_changed)
return (1);
/* if our subject is different from that of our closest previously displayed
* sibling, display the subject */
for (tmp = tree->prev; tmp; tmp = tmp->prev)
{
if (tmp->virtual >= 0 || (tmp->collapsed && (!ctx->pattern || tmp->limited)))
{
if (!tmp->subject_changed)
return (0);
if (tmp->subject_changed)
return (1);
else
break;
}
}
/* if there is a parent-to-child subject change anywhere between us and our
* closest displayed ancestor, display the subject */
for (tmp = tree->parent; tmp; tmp = tmp->parent)
{
if (tmp->virtual >= 0 || (tmp->collapsed && (!ctx->pattern || tmp->limited)))
......@@ -67,7 +74,9 @@ static int need_display_subject (CONTEXT *ctx, HEADER *tree)
else if (tmp->subject_changed)
return (1);
}
return (0);
/* if we have no visible parent or previous sibling, display the subject */
return (1);
}
/* determines whether a later sibling or the child of a later
......
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