aboutsummaryrefslogtreecommitdiffstats
path: root/lib/state
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2024-02-29 22:21:30 -0500
committerRobin Jarry <robin@jarry.cc>2024-03-04 22:33:15 +0100
commit6a84f1331f1c18dccfbe58601a4243995ac5c7d2 (patch)
treebd99fb962ad5824b14aa8db82aed3c0b909c67d7 /lib/state
parent2453375721832304b512380e6610de2c3d765bd5 (diff)
downloadaerc-6a84f1331f1c18dccfbe58601a4243995ac5c7d2.tar.gz
templates: add visual mode indicator to TrayInfo
It's useful to have some indicator of whether or not aerc is in visual mark mode. Add such an indicator to the TrayInfo available in the status line. Changelog-changed: The `TrayInfo` template variable now includes a visual mark mode indicator. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/state')
-rw-r--r--lib/state/templates.go9
-rw-r--r--lib/state/texter.go9
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/state/templates.go b/lib/state/templates.go
index e1570cd3..37767660 100644
--- a/lib/state/templates.go
+++ b/lib/state/templates.go
@@ -27,6 +27,7 @@ type DataSetter interface {
Data() models.TemplateData
SetHeaders(*mail.Header, *models.OriginalMail)
SetInfo(*models.MessageInfo, int, bool)
+ SetVisual(bool)
SetThreading(string, bool, int, int, bool, bool)
SetComposer(Composer)
SetAccount(*config.AccountConfig)
@@ -54,6 +55,7 @@ type templateData struct {
info *models.MessageInfo
marked bool
msgNum int
+ visual bool
// message list threading
threadInfo ThreadInfo
@@ -94,6 +96,10 @@ func (d *templateData) SetInfo(info *models.MessageInfo, num int, marked bool,
d.marked = marked
}
+func (d *templateData) SetVisual(visual bool) {
+ d.visual = visual
+}
+
func (d *templateData) SetThreading(prefix string, same bool, count int,
unread int, folded bool, context bool,
) {
@@ -624,6 +630,9 @@ func (d *templateData) TrayInfo() string {
if d.state.passthrough {
tray = append(tray, texter().Passthrough())
}
+ if d.visual {
+ tray = append(tray, texter().Visual())
+ }
return strings.Join(tray, config.Statusline.Separator)
}
diff --git a/lib/state/texter.go b/lib/state/texter.go
index 9212108d..f51d4d33 100644
--- a/lib/state/texter.go
+++ b/lib/state/texter.go
@@ -12,6 +12,7 @@ type texterInterface interface {
Passthrough() string
Sorting() string
Threading() string
+ Visual() string
FormatFilter(string) string
FormatSearch(string) string
}
@@ -40,6 +41,10 @@ func (t text) Threading() string {
return "threading"
}
+func (t text) Visual() string {
+ return "visual"
+}
+
func (t text) FormatFilter(s string) string {
return s
}
@@ -72,6 +77,10 @@ func (i icon) Threading() string {
return "๐Ÿงต"
}
+func (i icon) Visual() string {
+ return "๐Ÿ•ถ"
+}
+
func (i icon) FormatFilter(s string) string {
return strings.ReplaceAll(s, "filter", "๐Ÿ”ฆ")
}