mirror of
https://github.com/rivo/tview.git
synced 2024-11-12 19:10:28 +00:00
Allow changing current node during handler
This commit is contained in:
parent
77ccc1ff41
commit
7b79cb6347
@ -747,13 +747,14 @@ func (t *TreeView) MouseHandler() func(action MouseAction, event *tcell.EventMou
|
||||
if y >= 0 && y < len(t.nodes) {
|
||||
node := t.nodes[y]
|
||||
if node.selectable {
|
||||
if t.currentNode != node && t.changed != nil {
|
||||
previousNode := t.currentNode
|
||||
t.currentNode = node
|
||||
if previousNode != node && t.changed != nil {
|
||||
t.changed(node)
|
||||
}
|
||||
if t.selected != nil {
|
||||
t.selected(node)
|
||||
}
|
||||
t.currentNode = node
|
||||
}
|
||||
}
|
||||
consumed = true
|
||||
|
Loading…
Reference in New Issue
Block a user