Skip to content

Commit

Permalink
Fix scrollbar region calculation to support zero-thickness scrollbars
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 9, 2023
1 parent b2806fa commit 2e4e9f3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ def vertical_scrollbar(self) -> ScrollBar:

@property
def horizontal_scrollbar(self) -> ScrollBar:
"""The a horizontal scrollbar.
"""The horizontal scrollbar.
Note:
This will *create* a scrollbar if one doesn't exist.
Expand Down Expand Up @@ -2701,8 +2701,8 @@ def _arrange_scrollbars(self, region: Region) -> Iterable[tuple[Widget, Region]]
horizontal_scrollbar_region,
scrollbar_corner_gap,
) = region.split(
-scrollbar_size_vertical,
-scrollbar_size_horizontal,
region.width - scrollbar_size_vertical,
region.height - scrollbar_size_horizontal,
)
if scrollbar_corner_gap:
yield self.scrollbar_corner, scrollbar_corner_gap
Expand All @@ -2719,7 +2719,7 @@ def _arrange_scrollbars(self, region: Region) -> Iterable[tuple[Widget, Region]]

elif show_vertical_scrollbar:
window_region, scrollbar_region = region.split_vertical(
-scrollbar_size_vertical
region.width - scrollbar_size_vertical
)
if scrollbar_region:
scrollbar = self.vertical_scrollbar
Expand All @@ -2728,7 +2728,7 @@ def _arrange_scrollbars(self, region: Region) -> Iterable[tuple[Widget, Region]]
yield scrollbar, scrollbar_region
elif show_horizontal_scrollbar:
window_region, scrollbar_region = region.split_horizontal(
-scrollbar_size_horizontal
region.height - scrollbar_size_horizontal
)
if scrollbar_region:
scrollbar = self.horizontal_scrollbar
Expand Down

0 comments on commit 2e4e9f3

Please sign in to comment.