aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-11-07 22:31:24 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-09 21:43:07 +0100
commit9b49bb1c80e0f713cef59b3617e07ae1e1a3c951 (patch)
treeb9ac89d1d1a1965192481198e82cf56046cda2fe
parent47a0f7d8e88ef47a127f42113e28f053c6ff04b8 (diff)
downloadaerc-9b49bb1c80e0f713cef59b3617e07ae1e1a3c951.tar.gz
dirtree: show dynamic folders properly
Show dynamic folders from notmuch queries using :cf when using the directory tree view. The current dirtree implementation would swallow the query list entry but show the folder contents correctly in the message list. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net>
-rw-r--r--widgets/dirtree.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/widgets/dirtree.go b/widgets/dirtree.go
index f475255f..3d0b167b 100644
--- a/widgets/dirtree.go
+++ b/widgets/dirtree.go
@@ -7,6 +7,7 @@ import (
"strings"
"git.sr.ht/~rjarry/aerc/config"
+ "git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/logging"
"git.sr.ht/~rjarry/aerc/worker/types"
@@ -157,6 +158,20 @@ func (dt *DirectoryTree) Clicked(x int, y int) (string, bool) {
return "", false
}
+func (dt *DirectoryTree) SelectedMsgStore() (*lib.MessageStore, bool) {
+ if findString(dt.treeDirs, dt.selected) < 0 {
+ dt.buildTree()
+ if idx := findString(dt.treeDirs, dt.selected); idx >= 0 {
+ selIdx, node := dt.getTreeNode(uint32(idx))
+ if node != nil {
+ makeVisible(node)
+ dt.listIdx = selIdx
+ }
+ }
+ }
+ return dt.DirectoryList.SelectedMsgStore()
+}
+
func (dt *DirectoryTree) Select(name string) {
idx := findString(dt.treeDirs, name)
if idx >= 0 {