diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-09-25 09:07:44 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-09-27 23:14:14 +0200 |
commit | 55bcca4a31f29d58f2cc07dc0b17e2fd7da5f590 (patch) | |
tree | e111e87e260b219cd936b326ab3f9186356a373b | |
parent | 4ec1e1a5e4c74236a6d1992c8778c39fd25d847b (diff) | |
download | aerc-55bcca4a31f29d58f2cc07dc0b17e2fd7da5f590.tar.gz aerc-55bcca4a31f29d58f2cc07dc0b17e2fd7da5f590.zip |
commands: add :toggle-thread-context command
Add a command to toggle the display of an thread-context. Update
CHANGELOG.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | commands/msg/toggle-thread-context.go | 36 | ||||
-rw-r--r-- | doc/aerc.1.scd | 4 | ||||
-rw-r--r-- | lib/msgstore.go | 8 |
4 files changed, 49 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e9b3f2a..0897c6a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). temporary file from which selected files will be read instead of the standard output. - Save drafts in custom folders with `:postpone -t <folder>`. +- View "thread-context" in notmuch backends with `:toggle-thread-context`. ### Fixed diff --git a/commands/msg/toggle-thread-context.go b/commands/msg/toggle-thread-context.go new file mode 100644 index 00000000..09c60b85 --- /dev/null +++ b/commands/msg/toggle-thread-context.go @@ -0,0 +1,36 @@ +package msg + +import ( + "errors" + + "git.sr.ht/~rjarry/aerc/lib/ui" + "git.sr.ht/~rjarry/aerc/widgets" +) + +type ToggleThreadContext struct{} + +func init() { + register(ToggleThreadContext{}) +} + +func (ToggleThreadContext) Aliases() []string { + return []string{"toggle-thread-context"} +} + +func (ToggleThreadContext) Complete(aerc *widgets.Aerc, args []string) []string { + return nil +} + +func (ToggleThreadContext) Execute(aerc *widgets.Aerc, args []string) error { + if len(args) != 1 { + return errors.New("Usage: toggle-entire-thread") + } + h := newHelper(aerc) + store, err := h.store() + if err != nil { + return err + } + store.ToggleThreadContext() + ui.Invalidate() + return nil +} diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd index 8515370a..b2123a54 100644 --- a/doc/aerc.1.scd +++ b/doc/aerc.1.scd @@ -503,6 +503,10 @@ message list, the message in the message viewer, etc). in *[ui].index-columns*. See *aerc-config*(5) and *aerc-templates*(7) for more details. +*:toggle-thread-context* + Toggles between showing entire thread (when supported) and only showing + messages which match the current query / mailbox. + *:view* [*-p*]++ *:view-message* [*-p*] Opens the message viewer to display the selected message. If the peek diff --git a/lib/msgstore.go b/lib/msgstore.go index 6186b195..ab48f331 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -442,6 +442,14 @@ func (store *MessageStore) ThreadedView() bool { return store.threadedView } +func (store *MessageStore) ToggleThreadContext() { + if !store.threadedView { + return + } + store.threadContext = !store.threadContext + store.Sort(store.sortCriteria, nil) +} + func (store *MessageStore) BuildThreads() bool { return store.buildThreads } |