Skip to content

Commit 92583b5

Browse files
authored
Merge pull request #4636 from Textualize/tree-click-target-increase
Quality of life: Expand the hover/click area for the tree nodes
2 parents 2618bae + 2317cea commit 92583b5

File tree

3 files changed

+373
-370
lines changed

3 files changed

+373
-370
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717
### Changed
1818

1919
- `home` and `end` now works horizontally instead of vertically in DataTable https://github.com/Textualize/textual/pull/4633
20+
- `Tree` and `DirectoryTree` nodes now have a bigger click target, spanning the full line https://github.com/Textualize/textual/pull/4636
2021

2122
### Fixed
2223

src/textual/widgets/_tree.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,8 @@ def get_guides(style: Style) -> tuple[str, str, str, str]:
10891089
else:
10901090
line_style = base_style
10911091

1092+
line_style += Style(meta={"line": y})
1093+
10921094
guides = Text(style=line_style)
10931095
guides_append = guides.append
10941096

@@ -1124,7 +1126,7 @@ def get_guides(style: Style) -> tuple[str, str, str, str]:
11241126
)
11251127

11261128
label = self.render_label(line.path[-1], line_style, label_style).copy()
1127-
label.stylize(Style(meta={"node": line.node._id, "line": y}))
1129+
label.stylize(Style(meta={"node": line.node._id}))
11281130
guides.append(label)
11291131

11301132
segments = list(guides.render(self.app.console))

0 commit comments

Comments
 (0)