macOS: don't yank the viewport to the bottom while scrolled up - #579
Closed
gilbert-barajas wants to merge 2 commits into
Closed
macOS: don't yank the viewport to the bottom while scrolled up#579gilbert-barajas wants to merge 2 commits into
gilbert-barajas wants to merge 2 commits into
Conversation
…ring commit but never committed, broke the build Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Root cause: the macOS view never set Terminal.userScrolling — the only flag the
feed consults (Terminal.swift:5378 'if !userScrolling { yDisp = yBase }') — so
every line of output forced the viewport to the bottom. scrollTo(row:) now drives
userScrolling from the scroll position (parked above bottom => true, at bottom =>
false). Typing already routes through ensureCaretIsVisible -> scrollTo(yBase),
which clears it. Headless test reproduces the yank and verifies the hold.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
Mhm, we have had a few attempts at addressing this, let me see if I can find my notes on the other attempts - although I think they were mostly iOS based. |
Owner
|
I took a look at this, since I had a previous effort in a branch, but it was not quite complete and needed a few tuneups. I am happy now with what we have in iOS and I think it works fine on MacOS, can you take it for a spin? I think this is now fixed. If it is not, please reopen the bug. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When new output arrives while the user has scrolled up into the scrollback, the viewport jumps back to the bottom — yanking them away from what they were reading. Follow-tail should only auto-scroll when the viewport is already pinned to the bottom.
Fix
Follow the tail (auto-scroll on new output) only when the user is already at the bottom; otherwise preserve the current scroll position.
Tests
TerminalFollowTailTestscovers both the scrolled-up case (position preserved) and the at-bottom case (follows new output).Note
Split out of #555 (live-resize reflow) for review hygiene — it was an unrelated change riding along. Includes a one-line
SyncDebugno-op so the package builds (it's referenced onmainbut never committed); that build-unblocker is shared with #555 and will drop out on rebase once either lands.