Skip to content

Commit 2fb527b

Browse files
authored
Merge pull request #5404 from Textualize/footer-scroll
Add ability to scroll Footer without holding shift
2 parents 5889c48 + 3c7190a commit 2fb527b

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## Unreleased
99

10+
1011
### Fixed
1112

1213
- Fixed `Pilot.click` not working with `times` parameter https://github.com/Textualize/textual/pull/5398
@@ -20,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2021

2122
- The content of an `Input` will now only be automatically selected when the widget is focused by the user, not when the app itself has regained focus (similar to web browsers). https://github.com/Textualize/textual/pull/5379
2223
- Updated `TextArea` and `Input` behavior when there is a selection and the user presses left or right https://github.com/Textualize/textual/pull/5400
24+
- Footer can now be scrolled horizontally without holding `shift` https://github.com/Textualize/textual/pull/5404
2325

2426

2527
## [1.0.0] - 2024-12-12

src/textual/events.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ class MouseScrollDown(MouseEvent, bubble=True, verbose=True):
539539
"""Sent when the mouse wheel is scrolled *down*.
540540
541541
- [X] Bubbles
542-
- [ ] Verbose
542+
- [X] Verbose
543543
"""
544544

545545

@@ -548,7 +548,7 @@ class MouseScrollUp(MouseEvent, bubble=True, verbose=True):
548548
"""Sent when the mouse wheel is scrolled *up*.
549549
550550
- [X] Bubbles
551-
- [ ] Verbose
551+
- [X] Verbose
552552
"""
553553

554554

src/textual/widgets/_footer.py

+15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import rich.repr
77
from rich.text import Text
88

9+
from textual import events
910
from textual.app import ComposeResult
1011
from textual.binding import Binding
1112
from textual.containers import ScrollableContainer
@@ -249,6 +250,20 @@ async def bindings_changed(self, screen: Screen) -> None:
249250
if self.is_attached and screen is self.screen:
250251
await self.recompose()
251252

253+
def _on_mouse_scroll_down(self, event: events.MouseScrollDown) -> None:
254+
if self.allow_horizontal_scroll:
255+
self._clear_anchor()
256+
if self._scroll_right_for_pointer(animate=True):
257+
event.stop()
258+
event.prevent_default()
259+
260+
def _on_mouse_scroll_up(self, event: events.MouseScrollUp) -> None:
261+
if self.allow_horizontal_scroll:
262+
self._clear_anchor()
263+
if self._scroll_left_for_pointer(animate=True):
264+
event.stop()
265+
event.prevent_default()
266+
252267
def on_mount(self) -> None:
253268
self.call_next(self.bindings_changed, self.screen)
254269
self.screen.bindings_updated_signal.subscribe(self, self.bindings_changed)

0 commit comments

Comments
 (0)