mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Keep a visible, but darker, cursor in Tree when it doesn't have focus
See #1471. It seems useful and important for a Tree to still have a cursor visible even when it doesn't have focus -- that ways someone can build a UI where the user can tab away from the tree to something that relates to the node, and still see which node is in play.
This commit is contained in:
@@ -341,11 +341,15 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
|
||||
}
|
||||
|
||||
Tree > .tree--cursor {
|
||||
background: $secondary;
|
||||
background: $secondary-darken-2;
|
||||
color: $text;
|
||||
text-style: bold;
|
||||
}
|
||||
|
||||
Tree:focus > .tree--cursor {
|
||||
background: $secondary;
|
||||
}
|
||||
|
||||
Tree > .tree--highlight {
|
||||
text-style: underline;
|
||||
}
|
||||
@@ -925,7 +929,7 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
|
||||
label_style += self.get_component_rich_style(
|
||||
"tree--highlight", partial=True
|
||||
)
|
||||
if self.cursor_line == y and self.has_focus:
|
||||
if self.cursor_line == y:
|
||||
label_style += self.get_component_rich_style(
|
||||
"tree--cursor", partial=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user