From 2e4e9f36ece714542d98b3864b1301d513794f1b Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Mon, 9 Oct 2023 17:05:05 +0100 Subject: [PATCH] Fix scrollbar region calculation to support zero-thickness scrollbars --- src/textual/widget.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/textual/widget.py b/src/textual/widget.py index b229c70735..bad70dcf09 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -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. @@ -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 @@ -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 @@ -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