From dc2a2c2dfd6dc327fe40fbf2da922ef6c3d520be Mon Sep 17 00:00:00 2001 From: y0ast Date: Fri, 12 Nov 2021 18:12:02 +0100 Subject: messages: allow displaying email threads Display threads in the message list. For now, only supported by the notmuch backend and on IMAP when the server supports the THREAD extension. Setting threading-enable=true is global and will cause the message list to be empty with maildir:// accounts. Co-authored-by: Kevin Kuehler Co-authored-by: Reto Brunner Signed-off-by: Robin Jarry --- lib/format/format.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/format') diff --git a/lib/format/format.go b/lib/format/format.go index 8681de8e..59b5c479 100644 --- a/lib/format/format.go +++ b/lib/format/format.go @@ -45,6 +45,10 @@ type Ctx struct { MsgNum int MsgInfo *models.MessageInfo MsgIsMarked bool + + // UI controls for threading + ThreadPrefix string + ThreadSameSubject bool } func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string, @@ -213,7 +217,13 @@ func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string, args = append(args, addrs) case 's': retval = append(retval, 's') - args = append(args, envelope.Subject) + // if we are threaded strip the repeated subjects unless it's the + // first on the screen + subject := envelope.Subject + if ctx.ThreadSameSubject { + subject = "" + } + args = append(args, ctx.ThreadPrefix+subject) case 't': if len(envelope.To) == 0 { return "", nil, -- cgit