Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quality of life: Expand the hover/click area for the tree nodes #4636

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed

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

### Fixed

Expand Down
4 changes: 3 additions & 1 deletion src/textual/widgets/_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,8 @@ def get_guides(style: Style) -> tuple[str, str, str, str]:
else:
line_style = base_style

line_style += Style(meta={"line": y})

guides = Text(style=line_style)
guides_append = guides.append

Expand Down Expand Up @@ -1124,7 +1126,7 @@ def get_guides(style: Style) -> tuple[str, str, str, str]:
)

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

segments = list(guides.render(self.app.console))
Expand Down
Loading
Loading