aboutsummaryrefslogtreecommitdiffstats
path: root/lib/format/format.go
diff options
context:
space:
mode:
authory0ast <joost@joo.st>2021-11-12 18:12:02 +0100
committerRobin Jarry <robin@jarry.cc>2021-11-13 15:05:59 +0100
commitdc2a2c2dfd6dc327fe40fbf2da922ef6c3d520be (patch)
tree4987160692aca01e27b068cb256d66d373556a52 /lib/format/format.go
parentc303b953360994966ff657c4e17670853198ecf7 (diff)
downloadaerc-dc2a2c2dfd6dc327fe40fbf2da922ef6c3d520be.tar.gz
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 <keur@xcf.berkeley.edu> Co-authored-by: Reto Brunner <reto@labrat.space> Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/format/format.go')
-rw-r--r--lib/format/format.go12
1 files changed, 11 insertions, 1 deletions
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,