diff options
Diffstat (limited to 'widgets/dirtree.go')
-rw-r--r-- | widgets/dirtree.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/widgets/dirtree.go b/widgets/dirtree.go index c11a1fd0..98b25850 100644 --- a/widgets/dirtree.go +++ b/widgets/dirtree.go @@ -23,6 +23,9 @@ type DirectoryTree struct { list []*types.Thread treeDirs []string + + virtual bool + virtualCb func() } func NewDirectoryTree(dirlist *DirectoryList) DirectoryLister { @@ -30,10 +33,15 @@ func NewDirectoryTree(dirlist *DirectoryList) DirectoryLister { DirectoryList: dirlist, listIdx: -1, list: make([]*types.Thread, 0), + virtualCb: func() {}, } return dt } +func (dt *DirectoryTree) OnVirtualNode(cb func()) { + dt.virtualCb = cb +} + func (dt *DirectoryTree) ClearList() { dt.list = make([]*types.Thread, 0) dt.selected = "" @@ -168,6 +176,9 @@ func (dt *DirectoryTree) Clicked(x int, y int) (string, bool) { } func (dt *DirectoryTree) SelectedMsgStore() (*lib.MessageStore, bool) { + if dt.virtual { + return nil, false + } if findString(dt.treeDirs, dt.selected) < 0 { dt.buildTree() if idx := findString(dt.treeDirs, dt.selected); idx >= 0 { @@ -229,7 +240,11 @@ func (dt *DirectoryTree) NextPrev(delta int) { dt.listIdx = newIdx if path := dt.getDirectory(dt.list[dt.listIdx]); path != "" { + dt.virtual = false dt.Select(path) + } else { + dt.virtual = true + dt.virtualCb() } } |