aboutsummaryrefslogtreecommitdiffstats
path: root/config
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 /config
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 'config')
-rw-r--r--config/aerc.conf2
-rw-r--r--config/templates.go3
-rw-r--r--config/ui.go4
-rw-r--r--config/ui_test.go2
4 files changed, 6 insertions, 5 deletions
diff --git a/config/aerc.conf b/config/aerc.conf
index 9d1f120e..cb6e8649 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -63,7 +63,7 @@
#column-date={{.DateAutoFormat .Date.Local}}
#column-name={{index (.From | names) 0}}
#column-flags={{.Flags | join ""}}
-#column-subject={{.Subject}}
+#column-subject={{.ThreadPrefix}}{{.Subject}}
#
# String separator inserted between columns. When the column width specifier is
diff --git a/config/templates.go b/config/templates.go
index d3e7cfb0..96fbccb1 100644
--- a/config/templates.go
+++ b/config/templates.go
@@ -74,7 +74,8 @@ func (d *dummyData) ReplyTo() []*mail.Address { return nil }
func (d *dummyData) Date() time.Time { return time.Now() }
func (d *dummyData) DateAutoFormat(time.Time) string { return "" }
func (d *dummyData) Header(string) string { return "" }
-func (d *dummyData) Subject() string { return "[PATCH] hey" }
+func (d *dummyData) ThreadPrefix() string { return "└─>" }
+func (d *dummyData) Subject() string { return "Re: [PATCH] hey" }
func (d *dummyData) Number() int { return 0 }
func (d *dummyData) Labels() []string { return nil }
func (d *dummyData) Flags() []string { return nil }
diff --git a/config/ui.go b/config/ui.go
index f52cf7f8..4b2a303a 100644
--- a/config/ui.go
+++ b/config/ui.go
@@ -284,7 +284,7 @@ func (*UIConfig) ParseIndexColumns(section *ini.Section, key *ini.Key) ([]*Colum
_, _ = section.NewKey("column-flags", `{{.Flags | join ""}}`)
}
if !section.HasKey("column-subject") {
- _, _ = section.NewKey("column-subject", `{{.Subject}}`)
+ _, _ = section.NewKey("column-subject", `{{.ThreadPrefix}}{{.Subject}}`)
}
return ParseColumnDefs(key, section)
}
@@ -382,7 +382,7 @@ func indexVerbToTemplate(verb rune) (f, name string) {
f = `{{.Cc | persons | join ", "}}`
name = "cc"
case 's':
- f = "{{.Subject}}"
+ f = "{{.ThreadPrefix}}{{.Subject}}"
name = "subject"
case 't':
f = "{{(index .To 0).Address}}"
diff --git a/config/ui_test.go b/config/ui_test.go
index 80373da2..188fae01 100644
--- a/config/ui_test.go
+++ b/config/ui_test.go
@@ -43,7 +43,7 @@ func TestConvertIndexFormat(t *testing.T) {
assert.Equal(t, "subject", columns[3].Name)
assert.Equal(t, 0.0, columns[3].Width)
assert.Equal(t, ALIGN_LEFT|WIDTH_AUTO, columns[3].Flags)
- assert.Equal(t, `{{.Subject}}`, templateText(columns[3].Template))
+ assert.Equal(t, `{{.ThreadPrefix}}{{.Subject}}`, templateText(columns[3].Template))
}
func TestConvertDirlistFormat(t *testing.T) {