The "uncollapse_new" option is meant to uncollapse threads that contain **new** messages (as per man page).
In the normal case we don't need to do any checks for uncollapsing in update_index_threaded() because that code path usually only iterates over new messages by design. However for some edge cases this invariant does not hold, thus we now restrict the uncollapse action to messages that are either not old or unread. One such edge case can be reproduced as follows: - Save a copy of outgoing messages in the same mailbox with: folder-hook . 'set record=^' - Then navigate to a thread with no unread messages - Reply to an arbitrary message in that thread - Collapse the thread - Synchronize the mailbox Now mutt would falsely uncollapse the thread again, because it thinks the copy of our outgoing message is a new message. The issue is fixed with this patch, because the copy of that outgoing message is both read and old. In addition to the fix this patch contains a small indentation fix. --- curs_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/curs_main.c b/curs_main.c index 94df2037..d706208b 100644 --- a/curs_main.c +++ b/curs_main.c @@ -439,9 +439,10 @@ static void update_index_threaded (CONTEXT *ctx, int check, int oldcount) for (h = ctx->tree; h; h = h->next) { - for (j = h; !j->message; j = j->child) - ; - mutt_uncollapse_thread (ctx, j->message); + for (j = h; !j->message; j = j->child) + ; + if (!j->message->old || !j->message->read) + mutt_uncollapse_thread (ctx, j->message); } mutt_set_virtual (ctx); } -- 2.37.3