aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msglist.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-03-06 23:32:55 +0100
committerRobin Jarry <robin@jarry.cc>2023-03-08 00:42:53 +0100
commit159ad244ee23d69f2491b139fd4384c7620b83c2 (patch)
treed805e2e71e122c31d1f3291e3bc51fdb7306fc7f /widgets/msglist.go
parent21d0f3381e642764e8778bc909cb1fdb4cb5e7ce (diff)
downloadaerc-159ad244ee23d69f2491b139fd4384c7620b83c2.tar.gz
msglist: fix inconsistent thread subject deduplication
When threading is enabled, some messages which have different base subjects are hidden whereas some others which have similar subjects are displayed: [PATCH aerc v3 1/3] mk: remove smart rebuild when GOFLAGS have changed ├─>[PATCH aerc v3 2/3] mk: only install changed/missing files │ └─>Re: [PATCH aerc v3 2/3] mk: only install changed/missing files │ └─>Re: [PATCH aerc v3 2/3] mk: only install changed/missing files ├─> └─>Re: [PATCH aerc v3 1/3] mk: remove smart rebuild when GOFLAGS have changed This happens because we are using the "previous" message to get the subject base instead of the current one. Compute the base subject from the current message. Here is the result: [PATCH aerc v3 1/3] mk: remove smart rebuild when GOFLAGS have changed ├─>[PATCH aerc v3 2/3] mk: only install changed/missing files │ └─> │ └─> ├─>[PATCH aerc v3 3/3] mk: speed up notmuch detection └─>Re: [PATCH aerc v3 1/3] mk: remove smart rebuild when GOFLAGS have changed Fixes: 535300cfdbfc ("config: add columns based index format") Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r--widgets/msglist.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go
index ab8b89fa..24f3d3bf 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -6,6 +6,7 @@ import (
"math"
"strings"
+ sortthread "github.com/emersion/go-imap-sortthread"
"github.com/gdamore/tcell/v2"
"git.sr.ht/~rjarry/aerc/config"
@@ -158,7 +159,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
continue
}
- baseSubject := data.SubjectBase()
+ baseSubject := threadSubject(store, thread)
data.ThreadSameSubject = baseSubject == lastSubject &&
sameParent(thread, prevThread) &&
!isParent(thread)
@@ -466,3 +467,12 @@ func sameParent(left, right *types.Thread) bool {
func isParent(t *types.Thread) bool {
return t == t.Root()
}
+
+func threadSubject(store *lib.MessageStore, thread *types.Thread) string {
+ msg, found := store.Messages[thread.Uid]
+ if !found || msg == nil || msg.Envelope == nil {
+ return ""
+ }
+ subject, _ := sortthread.GetBaseSubject(msg.Envelope.Subject)
+ return subject
+}