Repository navigation
Changed(terminal-view): Anchor scrollback to document rows and use OverScroller sub-pixel scrolling - #5443
Open
qwerty123yucy wants to merge 1 commit into
Open
Changed(terminal-view): Anchor scrollback to document rows and use OverScroller sub-pixel scrolling#5443qwerty123yucy wants to merge 1 commit into
qwerty123yucy wants to merge 1 commit into
Conversation
qwerty123yucy
force-pushed
the
pr/anchored-overscroller
branch
from
November 17, 2026 05:04
288a096 to
369b6a7
Compare
…erScroller sub-pixel scrolling
qwerty123yucy
force-pushed
the
pr/anchored-overscroller
branch
from
November 17, 2026 07:42
369b6a7 to
ddb6b5a
Compare
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
TerminalViewtracks the scroll position as an integer row offsetmTopRowrelative to the bottom screen (0= top of screen,-N=Nrows into transcript). Unlessterminal-autoscroll-toggleis manually engaged beforehand, scrolling up into history immediately snaps back to0on the next output byte; and even when pinned, tracking viamScrollCountershifts only on UI updates and resets abruptly once the circular transcript buffer wraps.TerminalViewuses integer row deltas (Scrollerin row units +mScrollRemainder) and draws rows strictly at integer multiples ofmFontLineSpacing, producing line-stepped judder during slow finger drags and coasting flings on high-refresh-rate displays.Changes
TerminalBuffer&TerminalEmulator):mBaseAbsoluteRowinTerminalBuffercorresponding to external row0(mScreenFirstRow) across line scrolls and row/column resizes.mAnchoredDocRowandmFollowOutputinTerminalEmulator(pinViewportToBottom(),freezeViewportAtOffset(),setViewportOffset(),getViewportOffset()):mFollowOutput = false) while new output streams below, without requiringmAutoScrollDisabledto be toggled first; if circular buffer wraparound eventually reaches the anchored row,getViewportOffset()clamps at-rowsInHistoryinstead of snapping to0. Scrolling back to the bottom or typing user input re-engages live output following (mFollowOutput = true).CSI 3 J/RISreset: When a program clears the scrollback buffer viaCSI 3 J(clearTranscript()) orRIS(ESC c),mBaseAbsoluteRowremains monotonic and the viewport resets viapinViewportToBottom()unlessmAutoScrollDisabledis active (in which case it stays locked at the top of subsequent output, matchingmaster).OverScrollerrendering (TerminalView&TerminalRenderer):Scrollerwith pixel-spaceOverScroller(mScrollPixels+mSubRowOffsetPixelsin[0, mFontLineSpacing)), driving per-frame animation viacomputeScroll()andpostInvalidateOnAnimation(), with boundary guards inonFling(),computeScroll(), andonDown()so boundary flings terminate immediately without swallowing subsequent single-tap gestures.MotionEvent.ACTION_CANCELso gestures intercepted mid-drag by parent views (e.g.DrawerLayout) or system gestures restore the pre-gesture viewport state.TerminalRenderer.render(..., float subRowOffsetPx, ...)(preserving the existingrender(..., int topRow, ...)overload) that clips to the viewport and translates the canvas by-subRowOffsetPx, rendering one extra boundary row whensubRowOffsetPx > 0.getColumnAndRow(),getCursorY(), andgetPointY()inTerminalViewto account formSubRowOffsetPixels.ScrollPreservationTest):CSI 3 J/RIStranscript clear behavior (including long-session column-shrink redraws), and column-reflow resize preservation.(Note for reviewers: This PR is independent of #5444, though both touch
TerminalView/TerminalRenderer/TerminalEmulator. Happy to rebase whichever is reviewed second, or split theOverScrollerrendering change from the scrollback behavior change if preferred.)Testing
./gradlew test(150 unit tests includingScrollPreservationTest) and./gradlew assembleDebugin CI.v0.118.3and tested on an Android device (touch drag/fling boundaries, live streaming output, split-screen, and floating window).