Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/toad/conversation_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ class VimCancelAction(CancelAction):
vim_profile = True


class QuarterPageUpAction(ConversationAction):
"""Scroll the conversation up a quarter page."""

keys = ("shift+pageup",)
direction = -1

async def apply(self, conversation):
conversation.window.scroll_quarter_page(self.direction)


class QuarterPageDownAction(QuarterPageUpAction):
"""Scroll the conversation down a quarter page."""

keys = ("shift+pagedown",)
direction = 1


class ExpandBlockAction(ConversationAction):
"""Expand the block under the cursor."""

Expand Down
4 changes: 4 additions & 0 deletions src/toad/widgets/history_anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ def _on_mouse_scroll_down(self, event: events.MouseScrollDown) -> None:
def action_page_down(self) -> None:
self._scroll_or_prepare(max(1, self.scrollable_content_region.height), super().action_page_down)

def scroll_quarter_page(self, direction: int) -> None:
distance = direction * max(1, self.scrollable_content_region.height // 4)
self._scroll_or_prepare(distance, self.scroll_relative, None, distance)

def _on_mouse_scroll_left(self, event: events.MouseScrollLeft) -> None:
event.prevent_default()
super()._on_mouse_scroll_left(event)
Expand Down
Loading