2
0
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:
Chris Miller 2020-04-17 02:15:53 +00:00
parent 77ccc1ff41
commit 7b79cb6347

View File

@ -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