From 1e4dd1cee482309589dc47a7b2b448d24811c3e2 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Thu, 23 Mar 2023 20:59:44 +0000 Subject: [PATCH] fix scrollbar thumb height --- src/textual/scrollbar.py | 4 ---- src/textual/widget.py | 1 + tests/snapshot_tests/test_snapshots.py | 6 ++++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/textual/scrollbar.py b/src/textual/scrollbar.py index df5516ce9..f3dbc76cb 100644 --- a/src/textual/scrollbar.py +++ b/src/textual/scrollbar.py @@ -112,10 +112,6 @@ class ScrollBarRender: thumb_size = window_size / step_size * len_bars - if thumb_size < len_bars: - virtual_size += step_size - step_size = virtual_size / size - start = int(position / step_size * len_bars) end = start + max(len_bars, ceil(thumb_size)) diff --git a/src/textual/widget.py b/src/textual/widget.py index 9bf9966c0..8d6e62a21 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -2664,6 +2664,7 @@ class Widget(DOMNode): self._check_refresh() def _check_refresh(self) -> None: + """Check if a refresh was requested.""" if self._parent is not None and not self._closing: try: screen = self.screen diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index 75e5e7bfb..7c68f1405 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -334,3 +334,9 @@ def test_tabs_invalidate(snap_compare): SNAPSHOT_APPS_DIR / "tabs_invalidate.py", press=["tab", "right"], ) + + +def test_scrollbar_thumb_height(snap_compare): + assert snap_compare( + SNAPSHOT_APPS_DIR / "scrollbar_thumb_height.py", + )