Ensure the cursor node is set to None when the tree goes empty

Up until now there wasn't really a way for the tree to go empty, outside of
clear/reset. Now that we can remove nodes on the fly, that is possible. This
takes that into account.

See #2462.
This commit is contained in:
Dave Pearson
2023-05-08 09:16:58 +01:00
parent 2c39f50150
commit f34e738ddd

View File

@@ -845,6 +845,8 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
self._cursor_node = node
if previous_node != node:
self.post_message(self.NodeHighlighted(node))
else:
self._cursor_node = None
def watch_guide_depth(self, guide_depth: int) -> None:
self._invalidate()