Skip to content

Fix interactive terminal prompt scroll locking#9867

Open
fadexadex wants to merge 2 commits intowarpdotdev:masterfrom
fadexadex:fadex/fix-terminal-interactive-scroll-lock-gh9019
Open

Fix interactive terminal prompt scroll locking#9867
fadexadex wants to merge 2 commits intowarpdotdev:masterfrom
fadexadex:fadex/fix-terminal-interactive-scroll-lock-gh9019

Conversation

@fadexadex
Copy link
Copy Markdown

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 in app/src/terminal/view_test.rs.

Linked Issue

Fixes #9019

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Video (Before and after)

scroll.issue.fixed.mp4

Testing

  • New/updated unit tests in app/src/terminal/view_test.rs for interactive long-running scroll follow, manual scroll-away, and related viewport behavior.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Changelog Entries for Stable

CHANGELOG-BUG-FIX: Fixed interactive long-running prompts scrolling past the live cursor into empty backing-grid space.

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.
@cla-bot cla-bot Bot added the cla-signed label May 1, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 1, 2026

@fadexadex

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 1, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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

Comment thread app/src/terminal/block_list_viewport.rs Outdated
Comment on lines +1309 to +1311
ScrollPosition::FollowsBottomOfMostRecentBlock
| ScrollPosition::FollowsInteractiveCursor => ScrollPosition::FollowsInteractiveCursor,
ScrollPosition::WaterfallGapFollowsBottomOfMostRecentBlock { .. }
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.

⚠️ [IMPORTANT] Waterfall mode can still miss the interactive cursor boundary here. 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.

Suggested change
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,

@fadexadex
Copy link
Copy Markdown
Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 2, 2026

@fadexadex

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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
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.

⚠️ [IMPORTANT] 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal view gets stuck at the bottom during interactive commands (e.g., aws configure sso)

1 participant