feat(terminal): reduce xterm.js scrollback for background terminals#3361
Merged
gregpriday merged 2 commits intodevelopfrom Mar 16, 2026
Merged
Conversation
Collaborator
Author
|
Review status: Fixed and ready Fixes applied:
Reason: PR #3365 reduces
|
This was referenced Mar 16, 2026
…tions - Add SCROLLBACK_BACKGROUND=1000 constant to shared/config/scrollback.ts - Wire onTierApplied to call reduceScrollback on BACKGROUND tier and restoreScrollback on active tiers - Add isAltBuffer and hasSelection() guards to reduceScrollback to prevent data loss - Add deferred retry hooks in scroll, selection, and buffer-mode listeners for skipped trims - Add tests for new isAltBuffer and hasSelection guard conditions
- Add writtenData assertions to isAltBuffer and hasSelection skip tests - Verify no warning text is written when reduction is skipped
51d063b to
6ac9ca0
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.
Summary
Resolves #3281
Changes
shared/config/scrollback.ts: addedBACKGROUND_SCROLLBACKconstant (500 lines) to define the reduced background limitsrc/services/terminal/TerminalInstanceService.ts: addedapplyScrollbackForTier()method wired intoonTierApplied— expands on upgrade, shrinks on downgrade with scroll-position and selection guardssrc/services/terminal/__tests__/TerminalInstanceService.scrollback.test.ts: unit tests covering all guard conditions (scrolled up, active selection, alternate buffer) and the normal upgrade/downgrade pathsTesting
Unit tests pass. Guard conditions (scroll position, text selection, alternate buffer) tested directly. The alternate buffer case is implicitly safe — xterm.js enforces
scrollback: 0for alternate buffers regardless of what we set.