Fix terminal sticky scroll showing output instead of the executed command - #332438
Draft
Anthony Kim (anthonykim1) with Copilot wants to merge 4 commits into
Draft
Fix terminal sticky scroll showing output instead of the executed command#332438Anthony Kim (anthonykim1) with Copilot wants to merge 4 commits into
Anthony Kim (anthonykim1) with Copilot wants to merge 4 commits into
Conversation
…not fit Co-authored-by: anthonykim1 <62267334+anthonykim1@users.noreply.github.com>
Co-authored-by: anthonykim1 <62267334+anthonykim1@users.noreply.github.com>
Co-authored-by: anthonykim1 <62267334+anthonykim1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix terminal sticky scroll to show correct command
Fix terminal sticky scroll showing output instead of the executed command
Aug 24, 2026
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.
Description
Sticky scroll could pin rows of unrelated output (e.g. the tail of a previous
npm install) instead of the command line that produced the output currently in view.The overlay built its render window starting at the prompt start and capped it at
maxLineCountrows from the top:When
promptRowCount > maxLineCount, that window ends above the command line, so only rows preceding the command are rendered.promptRowCountinflates easily:handlePromptStartclones the previous command's end marker as the prompt start, so anything printed between a command finishing and the next prompt being drawn (background/late process output, job control notices, shell chatter) counts as prompt rows.maxLineCountismin(terminal.integrated.stickyScroll.maxLineCount, floor(rows * 0.4)), so a short panel (≈11 rows → 4) makes this easy to hit.Changes
terminalStickyScrollOverlay.ts— row math extracted into an exported puregetStickyScrollLayout()that prioritizes the command line: prompt rows are included only when prompt + command fit withinmaxLineCount, otherwise the window starts at the command start row (which still carries the prompt terminator, e.g.$). Unchanged in the common case where the prompt fits.isTruncated— the trailing…is now appended only when content is genuinely cut off at the bottom, rather than whenever the prompt didn't fit.rowOffsetclips every row, instead of resizing to a zero/negative row count and serializing a stray output row.stickyScroll/test/browser/terminalStickyScrollOverlay.test.tscovering the layout function, plus a case driven by the realCommandDetectionCapabilitythat reproduces the reported scenario (output printed after the previous command finished ⇒promptRowCount: 6vsmaxLineCount: 5).Note the hide check
buffer.viewportY <= stickyScrollLineStartnow compares against the command start row when the prompt is dropped, so the overlay disappears exactly when the command line itself scrolls into view.An alternative to dropping the prompt entirely would be trimming prompt rows from the top to fill the available space — that keeps the overlay full height but still shows the unrelated output the issue complains about, so this takes the simpler route. Happy to switch if preferred.