Skip to content

fix(tui): add mouse scroll support to pager overlay#1716

Closed
tdccccc wants to merge 2 commits into
Hmbown:mainfrom
tdccccc:fix/pager-mouse-scroll
Closed

fix(tui): add mouse scroll support to pager overlay#1716
tdccccc wants to merge 2 commits into
Hmbown:mainfrom
tdccccc:fix/pager-mouse-scroll

Conversation

@tdccccc

@tdccccc tdccccc commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • PagerView (Ctrl+O activity detail, tool details) now supports mouse wheel scrolling
  • Scroll up/down moves 3 lines per tick, consistent with transcript scroll granularity

Problem

The pager overlay ignored all mouse events. Users could only navigate with keyboard (j/k, PgUp/PgDn, Ctrl+D/U). This was inconvenient for users who prefer mouse-based scrolling.

Fix

Added handle_mouse implementation to PagerView that handles ScrollUp and ScrollDown events.

Test plan

  • Added mouse_scroll_up_scrolls_content test
  • Added mouse_scroll_down_scrolls_content test
  • All 33 pager tests pass

PagerView previously ignored mouse scroll events entirely. Terminals
with mouse capture now get scroll-up/scroll-down (3 lines per tick)
inside the pager, matching the transcript scroll granularity.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces mouse scroll support to the TUI pager, allowing users to navigate content using the mouse wheel. It also includes unit tests to verify the scrolling logic. Feedback was provided regarding a discrepancy between the scrolling logic and the rendering constraints; specifically, the ScrollDown implementation allows the scroll position to exceed the visual limit, creating a 'dead zone' that makes scrolling back up feel unresponsive.

Comment on lines +361 to +366
MouseEventKind::ScrollDown => {
let max_scroll = self.max_scroll();
self.scroll_down(3, max_scroll);
self.pending_g = false;
ViewAction::None
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ScrollDown logic uses self.max_scroll(), which allows scrolling until only the last line is at the top of the view. However, the render function (line 399) clamps the scroll position to lines.len() - visible_height to ensure the screen remains full. This discrepancy creates a 'dead zone' at the bottom where the mouse wheel continues to increment self.scroll without visual feedback, making subsequent scrolling up feel unresponsive for several ticks. While this matches the existing keyboard behavior, it is particularly noticeable with mouse wheel scrolling. Consider calculating the visual limit using self.last_visible_height to avoid this discrepancy.

Make scroll a Cell<usize> so render() can clamp it back to the visual
max on every frame. Previously scroll could overshoot the render limit,
creating a dead zone where scrolling up from the bottom required
multiple wheel ticks before content moved.
@Hmbown Hmbown added this to the v0.8.39 milestone May 16, 2026
Hmbown added a commit that referenced this pull request May 17, 2026
Bump workspace, inter-crate, and npm package versions 0.8.38 -> 0.8.39.

Roll CHANGELOG [Unreleased] into [0.8.39] with all fixes:
- Revert v0.8.38 /model picker rework (back to instant curated picker)
- Restore approval grouping (lossy v0.8.37 logic for approvals, exact key for denials)
- Thinking-only turn surface fix (#1727)
- ACP server JSON-RPC id stringification (#1696)
- Chat client: reasoning_content for generic providers (#1673)
- Compaction: user text query preservation (#1704)
- Engine: system prompt override survival (#1688)
- Pager: G/End overshoot fix (#1706), mouse scroll (#1716)
- Composer: scroll with text (#1677), multiline arrows (#1721)
- macOS system theme detection (#1670)
- rlm_open blank source fields (#1712)
- Terminal resize paging fix (#1724)
- Docker first-run permission (#1684)
- README Rust 1.88+ requirement note (#1718)

Tests: 3149 passed, 0 failed (deepseek-tui crate)
clippy: clean on --all-targets --all-features
@Hmbown

Hmbown commented May 17, 2026

Copy link
Copy Markdown
Owner

Thanks for the pager mouse-scroll patch. The useful slice was harvested into v0.8.39 via #1734 and credited in the changelog, so I am closing this PR to keep the queue clean. If latest still misses pager wheel events, please reopen with terminal details.

@Hmbown Hmbown closed this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants