diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-02-08 19:16:33 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-02-10 15:58:39 -0800 |
commit | 83be183b55a41b2ffb84177e8ce4e271fea67b00 (patch) | |
tree | 6f7c050dfc35c694d99a9a6cc13222afa8c31ad4 /thread.c | |
parent | 8d77022b4c94edbf197b11c07f0666bff0c1a08c (diff) |
Fix ~v tagging when switching to non-threaded sorting.
Place num_hidden in all the collapsed thread messages, rather than
just the visible ones (i.e. the root headers).
This is a tweak to commit 0f8a079d, where I discovered the behavior
inconsistent with the documentation. I'm making this change in master
due to the (tiny) behavior change.
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 43 |
1 files changed, 37 insertions, 6 deletions
@@ -1194,8 +1194,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag) /* return value depends on action requested */ if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE)) { - if (roothdr) - roothdr->num_hidden = num_hidden; + cur->num_hidden = num_hidden; return (final); } else if (flag & MUTT_THREAD_UNREAD) @@ -1279,13 +1278,45 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag) } } + /* retraverse the thread and store num_hidden in all headers, with + * or without a virtual index. this will allow ~v to match all + * collapsed messages when switching sort order to non-threaded. + */ + if (flag & MUTT_THREAD_COLLAPSE) + { + thread = top; + FOREVER + { + cur = thread->message; + if (cur) + cur->num_hidden = num_hidden + 1; + + if (thread->child) + thread = thread->child; + else if (thread->next) + thread = thread->next; + else + { + int done = 0; + while (!thread->next) + { + thread = thread->parent; + if (thread == top) + { + done = 1; + break; + } + } + if (done) + break; + thread = thread->next; + } + } + } + /* return value depends on action requested */ if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE)) - { - if (roothdr) - roothdr->num_hidden = num_hidden + 1; return (final); - } else if (flag & MUTT_THREAD_UNREAD) return ((old && new) ? new : (old ? old : new)); else if (flag & MUTT_THREAD_NEXT_UNREAD) |