Fix interactive terminal prompt scroll locking#9867
Fix interactive terminal prompt scroll locking#9867fadexadex wants to merge 2 commits intowarpdotdev:masterfrom
Conversation
Keep non-alt-screen interactive long-running prompts visible by following the live output cursor instead of the block bottom. Clamp interactive fixed-scroll states and scrollbar range to that cursor boundary so scrolling back up/down does not expose blank backing-grid space.
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds an interactive-cursor scroll mode for long-running terminal prompts, clamps the scroll range to that boundary, updates PTY input/wakeup paths to use it, and adds viewport tests.
Concerns
- Waterfall gap follow state is treated as a fixed/manual state during interactive PTY input, so Waterfall mode can keep the old bottom-of-backing-grid scroll range instead of switching to the live cursor boundary.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| ScrollPosition::FollowsBottomOfMostRecentBlock | ||
| | ScrollPosition::FollowsInteractiveCursor => ScrollPosition::FollowsInteractiveCursor, | ||
| ScrollPosition::WaterfallGapFollowsBottomOfMostRecentBlock { .. } |
There was a problem hiding this comment.
WaterfallGapFollowsBottomOfMostRecentBlock is a follow state, not a manual scroll-away state, so returning it unchanged leaves effective_max_scroll_top_in_lines() on the full backing-grid max and re-exposes the blank area this PR is trying to clamp.
| ScrollPosition::FollowsBottomOfMostRecentBlock | |
| | ScrollPosition::FollowsInteractiveCursor => ScrollPosition::FollowsInteractiveCursor, | |
| ScrollPosition::WaterfallGapFollowsBottomOfMostRecentBlock { .. } | |
| ScrollPosition::FollowsBottomOfMostRecentBlock | |
| | ScrollPosition::FollowsInteractiveCursor | |
| | ScrollPosition::WaterfallGapFollowsBottomOfMostRecentBlock { .. } => { | |
| ScrollPosition::FollowsInteractiveCursor | |
| } | |
| ScrollPosition::FixedAtPosition { .. } | |
| | ScrollPosition::FixedAtInteractivePosition { .. } | |
| | ScrollPosition::FixedWithinLongRunningBlock { .. } | |
| | ScrollPosition::FixedWithinInteractiveLongRunningBlock { .. } => self.scroll_position, |
|
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds interactive-cursor scroll positions, clamps scrollbar range to the live cursor for long-running prompts, and adds unit coverage for pinned-to-bottom and pinned-to-top cursor-follow behavior.
Concerns
- Pinned-to-top sessions can enter
FollowsInteractiveCursor, but the new manual-scroll boundary preservation only applies to pinned-to-bottom and waterfall modes, so manually scrolling in pinned-to-top can still fall back to the full backing-grid range.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| fn has_interactive_cursor_boundary(&self) -> bool { | ||
| matches!( | ||
| self.input_mode, | ||
| InputMode::PinnedToBottom | InputMode::Waterfall |
There was a problem hiding this comment.
PinnedToTop can enter FollowsInteractiveCursor, but this excludes it from preserving the cursor boundary on manual scrolls; a wheel scroll downgrades to non-interactive fixed modes and re-enables the backing-grid bottom. Include PinnedToTop here or avoid entering interactive follow mode for it.
Description
Fixes incorrect scroll locking for non–alt-screen interactive long-running prompts.
Problem: Viewport scrolling followed the bottom of the backing grid instead of the live PTY cursor, so users could scroll into empty grid space below the active prompt during flows like interactive CLIs.
Solution: Clamp scroll position and scrollbar range to the interactive cursor boundary, add scroll modes that preserve that boundary when the user scrolls manually, and apply the interactive follow update path on terminal wakeup when appropriate so prompt output stays visible without requiring a keystroke first.
Touches:
app/src/terminal/block_list_viewport.rs,app/src/terminal/block_list_element.rs,app/src/terminal/view.rs; tests inapp/src/terminal/view_test.rs.Linked Issue
Fixes #9019
ready-to-specorready-to-implement.Video (Before and after)
scroll.issue.fixed.mp4
Testing
app/src/terminal/view_test.rsfor interactive long-running scroll follow, manual scroll-away, and related viewport behavior.Agent Mode
Changelog Entries for Stable
CHANGELOG-BUG-FIX: Fixed interactive long-running prompts scrolling past the live cursor into empty backing-grid space.