summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2023-04-15 12:46:04 -0700
committerKevin McCarthy <kevin@8t8.us>2023-04-15 12:46:04 -0700
commit5347d1c5c0f529ad7e1464ce9f1716d54ed9c31a (patch)
treee308d79567883f682a2d088f516c5ea88dc2dbb3
parentd2ed5d1815a335dffe623e687954f20c6f8b8cb3 (diff)
parent50954c4ab74084815513ce8262946ab71e680e33 (diff)
Merge branch 'stable'
-rw-r--r--curs_main.c21
-rw-r--r--thread.c9
2 files changed, 21 insertions, 9 deletions
diff --git a/curs_main.c b/curs_main.c
index 052a5cef..3d79723c 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -2071,6 +2071,11 @@ int mutt_index_menu (void)
if (CURHDR->collapsed)
{
+ /* Note this returns the *old* virtual index of the root message.
+ *
+ * For sort=reverse-threads this trick allows uncollapsing a
+ * single thread to position on the first (not root) message
+ * in the thread */
menu->current = mutt_uncollapse_thread (Context, CURHDR);
mutt_set_virtual (Context);
if (option (OPTUNCOLLAPSEJUMP))
@@ -2078,8 +2083,22 @@ int mutt_index_menu (void)
}
else if (option (OPTCOLLAPSEUNREAD) || !UNREAD (CURHDR))
{
- menu->current = mutt_collapse_thread (Context, CURHDR);
+ HEADER *base;
+ int final;
+ /* This also returns the *old* virtual index of the root, but now
+ * we have to find the new position of the root, which isn't
+ * the same for sort=reverse-threads. */
+ final = mutt_collapse_thread (Context, CURHDR);
+ base = Context->hdrs[Context->v2r[final]];
mutt_set_virtual (Context);
+ for (j = 0; j < Context->vcount; j++)
+ {
+ if (Context->hdrs[Context->v2r[j]]->index == base->index)
+ {
+ menu->current = j;
+ break;
+ }
+ }
}
else
{
diff --git a/thread.c b/thread.c
index ddd1c7c1..86c051fe 100644
--- a/thread.c
+++ b/thread.c
@@ -1321,7 +1321,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
{
THREAD *thread, *top;
HEADER *roothdr = NULL;
- int final, reverse = (Sort & SORT_REVERSE), minmsgno;
+ int final;
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)
@@ -1340,7 +1340,6 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
while (!thread->message)
thread = thread->child;
cur = thread->message;
- minmsgno = cur->msgno;
if (!cur->read && CHECK_LIMIT)
{
@@ -1401,12 +1400,6 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag)
final = roothdr->virtual;
}
- if (reverse && (flag & MUTT_THREAD_COLLAPSE) && (cur->msgno < minmsgno) && CHECK_LIMIT)
- {
- minmsgno = cur->msgno;
- final = cur->virtual;
- }
-
if (flag & MUTT_THREAD_COLLAPSE)
{
if (cur != roothdr)