Take Tree.show_root into account when drawing guides

Rather than always start at the root, the code should start at the beginning
of the path.

See #2397.
This commit is contained in:
Dave Pearson
2023-05-04 08:53:24 +01:00
parent 90d9693168
commit 71c5a44fdb

View File

@@ -976,8 +976,8 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
"tree--guides-selected", partial=True "tree--guides-selected", partial=True
) )
hover = self.root._hover hover = line.path[0]._hover
selected = self.root._selected and self.has_focus selected = line.path[0]._selected and self.has_focus
def get_guides(style: Style) -> tuple[str, str, str, str]: def get_guides(style: Style) -> tuple[str, str, str, str]:
"""Get the guide strings for a given style. """Get the guide strings for a given style.