summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2001-09-03 13:59:37 +0000
committerThomas Roessler <roessler@does-not-exist.org>2001-09-03 13:59:37 +0000
commit76ecc91c1784c88a1147d88a5e2f370e06042c0f (patch)
tree9dab5fad01aea072daf812cfad3aa179100bd6bb
parenteae3148efcf54f2debce9c3f29cd74d4b39f45b2 (diff)
Don't lose track of the current message when collapsing and changing
sort modes wildly. Noted by David T-G.
-rw-r--r--curs_main.c11
-rw-r--r--thread.c2
2 files changed, 11 insertions, 2 deletions
diff --git a/curs_main.c b/curs_main.c
index 8baefbc2..07b82cbf 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -363,10 +363,12 @@ static void update_index (MUTTMENU *menu, CONTEXT *ctx, int check,
static void resort_index (MUTTMENU *menu)
{
int i;
- const HEADER *current = CURHDR;
+ HEADER *current = CURHDR;
+ menu->current = -1;
mutt_sort_headers (Context, 0);
/* Restore the current message */
+
for (i = 0; i < Context->vcount; i++)
{
if (Context->hdrs[Context->v2r[i]] == current)
@@ -375,6 +377,13 @@ static void resort_index (MUTTMENU *menu)
break;
}
}
+
+ if ((Sort & SORT_MASK) == SORT_THREADS && menu->current < 0)
+ menu->current = mutt_parent_message (Context, current);
+
+ if (menu->current < 0)
+ menu->current = ci_first_message ();
+
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
}
diff --git a/thread.c b/thread.c
index a071e90e..a729baeb 100644
--- a/thread.c
+++ b/thread.c
@@ -756,7 +756,7 @@ int mutt_parent_message (CONTEXT *ctx, HEADER *hdr)
{
while ((hdr = hdr->parent))
{
- if (!ctx->pattern || hdr->limited)
+ if (hdr->virtual >= 0 && hdr->collapsed && (!ctx->pattern || hdr->limited))
return (hdr->virtual);
}
mutt_error _("Parent message is not visible in limited view");