aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-03-03 17:37:05 +0100
committerRobin Jarry <robin@jarry.cc>2023-03-08 00:42:56 +0100
commit35040bec9962cac3c92039fac85a4068e148b0a0 (patch)
treeca33752e9ad3d00894468ae489497d3d168faeee /lib
parent159ad244ee23d69f2491b139fd4384c7620b83c2 (diff)
downloadaerc-35040bec9962cac3c92039fac85a4068e148b0a0.tar.gz
templates: separate thread prefix from subject
Extract {{.ThreadPrefix}} from {{.Subject}} so that the prefix can be styled in a different color. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/state/templates.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/state/templates.go b/lib/state/templates.go
index d5631b11..2e351a7a 100644
--- a/lib/state/templates.go
+++ b/lib/state/templates.go
@@ -23,8 +23,8 @@ type TemplateData struct {
msgNum int
// message list threading
- ThreadSameSubject bool
- ThreadPrefix string
+ threadSameSubject bool
+ threadPrefix string
// selected account
account *config.AccountConfig
@@ -50,6 +50,11 @@ func (d *TemplateData) SetInfo(info *models.MessageInfo, num int, marked bool) {
d.marked = marked
}
+func (d *TemplateData) SetThreading(prefix string, same bool) {
+ d.threadPrefix = prefix
+ d.threadSameSubject = same
+}
+
func (d *TemplateData) SetAccount(acct *config.AccountConfig) {
d.account = acct
d.myAddresses = make(map[string]bool)
@@ -220,6 +225,10 @@ func (d *TemplateData) Header(name string) string {
return text
}
+func (d *TemplateData) ThreadPrefix() string {
+ return d.threadPrefix
+}
+
func (d *TemplateData) Subject() string {
var subject string
switch {
@@ -228,10 +237,10 @@ func (d *TemplateData) Subject() string {
case d.headers != nil:
subject = d.Header("subject")
}
- if d.ThreadSameSubject {
+ if d.threadSameSubject {
subject = ""
}
- return d.ThreadPrefix + subject
+ return subject
}
func (d *TemplateData) SubjectBase() string {