~rjarry/aerc-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH aerc] templates: add visual mode indicator to TrayInfo

Details
Message ID
<20240301032209.366461-2-me@jasoncarloscox.com>
DKIM signature
pass
Download raw message
Patch: +29 -2
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 includes a visual
 mark mode indicator.
Cc: robertgzr <r@gnzler.io>
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
---
 app/status.go            | 3 +++
 doc/aerc-templates.7.scd | 4 ++--
 lib/marker/marker.go     | 6 ++++++
 lib/state/templates.go   | 9 +++++++++
 lib/state/texter.go      | 9 +++++++++
 5 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/app/status.go b/app/status.go
index a0cf5e6f..846e0e4e 100644
--- a/app/status.go
+++ b/app/status.go
@@ -56,6 +56,9 @@ func (status *StatusLine) Draw(ctx *ui.Context) {
		msg, _ := status.acct.SelectedMessage()
		data.SetInfo(msg, 0, false)
		data.SetRUE(status.acct.dirlist.List(), status.acct.dirlist.GetRUECount)
		if store := status.acct.Store(); store != nil {
			data.SetVisual(store.Marker().IsVisualMark())
		}
		table := ui.NewTable(
			ctx.Height(),
			config.Statusline.StatusColumns,
diff --git a/doc/aerc-templates.7.scd b/doc/aerc-templates.7.scd
index d0cb0f6e..71acc6b1 100644
--- a/doc/aerc-templates.7.scd
+++ b/doc/aerc-templates.7.scd
@@ -261,8 +261,8 @@ available always.
	{{.StatusInfo}}
	```

	General on/off information (e.g. passthrough, threading, sorting),
	separated with *[statusline].separator*.
	General on/off information (e.g. passthrough, threading, sorting, visual
	mode), separated with *[statusline].separator*.

	```
	{{.TrayInfo}}
diff --git a/lib/marker/marker.go b/lib/marker/marker.go
index 21c151f3..a0860be9 100644
--- a/lib/marker/marker.go
+++ b/lib/marker/marker.go
@@ -8,6 +8,7 @@ type Marker interface {
	Remark()
	Marked() []uint32
	IsMarked(uint32) bool
	IsVisualMark() bool
	ToggleVisualMark(bool)
	UpdateVisualMark()
	ClearVisualMark()
@@ -114,6 +115,11 @@ func (mc *controller) Marked() []uint32 {
	return marked
}

// IsVisualMark indicates whether visual marking mode is enabled.
func (mc *controller) IsVisualMark() bool {
	return mc.visualMarkMode
}

// ToggleVisualMark enters or leaves the visual marking mode
func (mc *controller) ToggleVisualMark(clear bool) {
	mc.visualMarkMode = !mc.visualMarkMode
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", "๐Ÿ”ฆ")
}
-- 
2.44.0

[aerc/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CZI3CTVUNC2U.238J6O7UIN4WD@fra01>
In-Reply-To
<20240301032209.366461-2-me@jasoncarloscox.com> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: SUCCESS in 2m7s

[templates: add visual mode indicator to TrayInfo][0] from [Jason Cox][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/49913
[1]: me@jasoncarloscox.com

โœ“ #1159862 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1159862
โœ“ #1159861 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1159861

Applied: [PATCH aerc] templates: add visual mode indicator to TrayInfo

Details
Message ID
<170958793985.17463.15629191728967719256@ringo>
In-Reply-To
<20240301032209.366461-2-me@jasoncarloscox.com> (view parent)
DKIM signature
pass
Download raw message
Jason Cox <me@jasoncarloscox.com> wrote:
> 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 includes a visual
>  mark mode indicator.
> Cc: robertgzr <r@gnzler.io>
> Signed-off-by: Jason Cox <me@jasoncarloscox.com>
> ---

Acked-by: Robin Jarry <robin@jarry.cc>

Applied, thanks.

To git@git.sr.ht:~rjarry/aerc
   245337572183..6a84f1331f1c  master -> master
Reply to thread Export thread (mbox)