diff options
author | Koni Marti <koni.marti@gmail.com> | 2023-07-18 10:29:52 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-06-25 15:28:11 +0200 |
commit | 7f66297c521fca8f9bc17280f0a96874598bde96 (patch) | |
tree | 643e1d5c6dbbf55814c689f2509f3eb9bd532fa2 /app/msglist.go | |
parent | 9cd806fa6e80829753ecd3356e19044d6e210826 (diff) | |
download | aerc-7f66297c521fca8f9bc17280f0a96874598bde96.tar.gz |
threadbuilder: show siblings even when no parent found
Show all threading associations even when not all nodes are present.
Indicate if a thread is incomplete, i.e. misses a direct parent node.
Use the `msglist_thread_orphan.fg=red` styleobject in your stylesheet to
indicate whether a messsage has a missing parent.
Also use a different thread prefix ("┬─" instead of "├─") not to confuse
them with regular threads that have a visible parent.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Matěj Cepl <mcepl@cepl.eu>
Diffstat (limited to 'app/msglist.go')
-rw-r--r-- | app/msglist.go | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/app/msglist.go b/app/msglist.go index 996ffa0c..24547b64 100644 --- a/app/msglist.go +++ b/app/msglist.go @@ -231,6 +231,9 @@ func addMessage( if templateData.ThreadContext() { params.styles = append(params.styles, config.STYLE_MSGLIST_THREAD_CONTEXT) } + if templateData.ThreadOrphan() { + params.styles = append(params.styles, config.STYLE_MSGLIST_THREAD_ORPHAN) + } } // marked message marked := store.Marker().IsMarked(msg.Uid) @@ -482,16 +485,20 @@ func threadPrefix(t *types.Thread, reverse bool, msglist bool) string { var hiddenOffspring bool = t.FirstChild != nil && t.FirstChild.Hidden > 0 var parentAndSiblings bool = t.Parent != nil && t.NextSibling != nil + var hasSiblings string = uiConfig.ThreadPrefixHasSiblings + if t.Parent != nil && t.Parent.Hidden > 0 && t.Hidden == 0 { + hasSiblings = dummy + } switch { case parentAndSiblings && hiddenOffspring: - prefix = uiConfig.ThreadPrefixHasSiblings + + prefix = hasSiblings + uiConfig.ThreadPrefixFolded case parentAndSiblings && t.FirstChild != nil: - prefix = uiConfig.ThreadPrefixHasSiblings + + prefix = hasSiblings + firstChild + tip case parentAndSiblings: - prefix = uiConfig.ThreadPrefixHasSiblings + + prefix = hasSiblings + uiConfig.ThreadPrefixLimb + uiConfig.ThreadPrefixUnfolded + tip case t.Parent != nil && hiddenOffspring: @@ -557,18 +564,19 @@ func newThreadView(store *lib.MessageStore) *threadView { } func (t *threadView) Update(data state.DataSetter, uid uint32) { - prefix, same, count, unread, folded, context := "", false, 0, 0, false, false thread, err := t.store.Thread(uid) + info := state.ThreadInfo{} if thread != nil && err == nil { - prefix = threadPrefix(thread, t.reverse, true) + info.Prefix = threadPrefix(thread, t.reverse, true) subject := threadSubject(t.store, thread) - same = subject == t.prevSubj && sameParent(thread, t.prev) && !isParent(thread) + info.SameSubject = subject == t.prevSubj && sameParent(thread, t.prev) && !isParent(thread) t.prev = thread t.prevSubj = subject - count = countThreads(thread) - unread = unreadInThread(thread, t.store) - folded = thread.FirstChild != nil && thread.FirstChild.Hidden != 0 - context = thread.Context + info.Count = countThreads(thread) + info.Unread = unreadInThread(thread, t.store) + info.Folded = thread.FirstChild != nil && thread.FirstChild.Hidden != 0 + info.Context = thread.Context + info.Orphan = thread.Parent != nil && thread.Parent.Hidden > 0 && thread.Hidden == 0 } - data.SetThreading(prefix, same, count, unread, folded, context) + data.SetThreading(info) } |