mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
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:
@@ -845,6 +845,8 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
|
|||||||
self._cursor_node = node
|
self._cursor_node = node
|
||||||
if previous_node != node:
|
if previous_node != node:
|
||||||
self.post_message(self.NodeHighlighted(node))
|
self.post_message(self.NodeHighlighted(node))
|
||||||
|
else:
|
||||||
|
self._cursor_node = None
|
||||||
|
|
||||||
def watch_guide_depth(self, guide_depth: int) -> None:
|
def watch_guide_depth(self, guide_depth: int) -> None:
|
||||||
self._invalidate()
|
self._invalidate()
|
||||||
|
|||||||
Reference in New Issue
Block a user