Skip to content

Commit d9f7ffd

Browse files
authored
Merge pull request #5641 from Textualize/fix-click-border
fix clicking on border in line api
2 parents ca975df + 4d15999 commit d9f7ffd

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Fixed
1111

1212
- Static and Label now accept Content objects, satisfying type checkers https://github.com/Textualize/textual/pull/5618
13+
- Fixed click selection not being disabled when allow_select was set to false https://github.com/Textualize/textual/issues/5627
14+
- Fixed crash on clicking line API border https://github.com/Textualize/textual/pull/5641
1315

1416
### Added
1517

1618
- Added Widget.preflight_checks to perform some debug checks after a widget is instantiated, to catch common errors. https://github.com/Textualize/textual/pull/5588
1719

18-
### Fixed
19-
20-
- Fixed click selection not being disabled when allow_select was set to false https://github.com/Textualize/textual/issues/5627
21-
2220
## [2.1.2] - 2025-02-26
2321

2422
### Fixed

src/textual/_compositor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,9 @@ def get_widget_and_offset_at(
900900
x -= region.x + gutter_left
901901
y -= region.y + gutter_right
902902

903+
if y < 0:
904+
return None, None
905+
903906
visible_screen_stack.set(widget.app._background_screens)
904907
line = widget.render_line(y)
905908

tests/test_widget.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,3 +668,18 @@ def compose(self) -> ComposeResult:
668668
assert labels[4].last_of_type
669669
assert labels[4].is_odd
670670
assert not labels[4].is_even
671+
672+
673+
async def test_click_line_api_border():
674+
"""Regression test for https://github.com/Textualize/textual/issues/5634"""
675+
676+
class MyApp(App):
677+
def compose(self) -> ComposeResult:
678+
self.my_log = Log()
679+
self.my_log.styles.border = ("round", "white")
680+
yield self.my_log
681+
682+
app = MyApp()
683+
async with app.run_test() as pilot:
684+
await pilot.pause()
685+
await pilot.click("Log", (10, 0))

0 commit comments

Comments
 (0)