Merge branch 'main' of ssh://git.bullercodeworks.com:2200/brian/expds
This commit is contained in:
@@ -106,6 +106,7 @@ func (w *TreeBrowser) GetKeyMap() *t.KeyMap { return w.keyMap }
|
||||
func (w *TreeBrowser) SetKeyMap(km *t.KeyMap) { w.keyMap = km }
|
||||
|
||||
func (w *TreeBrowser) HandleKey(ev *tcell.EventKey) bool {
|
||||
w.Log("TreeBrowser Handling Key: %s", ev.Name())
|
||||
if !w.active || !w.focusable {
|
||||
return false
|
||||
}
|
||||
@@ -141,6 +142,7 @@ func (w *TreeBrowser) Draw(screen tcell.Screen) {
|
||||
break
|
||||
}
|
||||
}
|
||||
th.DrawText(x, y, fmt.Sprintf("Cursor: %d", w.cursor), w.style, screen)
|
||||
}
|
||||
|
||||
func (w *TreeBrowser) SetStyle(s tcell.Style) { w.style = s }
|
||||
@@ -292,6 +294,9 @@ func (w *TreeBrowser) UpdateList() {
|
||||
if w.cursor >= len(w.list) {
|
||||
w.cursor = len(w.list) - 1
|
||||
}
|
||||
if w.cursor <= 0 {
|
||||
w.cursor = 0
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -359,3 +364,17 @@ func (tn *TreeNode) AddChild(t *TreeNode, rest ...*TreeNode) {
|
||||
}
|
||||
|
||||
func (tn *TreeNode) HasChildren() bool { return len(tn.children) > 0 }
|
||||
func (tn *TreeNode) GetPath() []string {
|
||||
var path []string
|
||||
if tn.parent != nil {
|
||||
path = tn.parent.GetPath()
|
||||
}
|
||||
return append(path, tn.value)
|
||||
}
|
||||
func (tn *TreeNode) GetLabelPath() []string {
|
||||
var path []string
|
||||
if tn.parent != nil {
|
||||
path = tn.parent.GetLabelPath()
|
||||
}
|
||||
return append(path, tn.label)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user