{{ message }}
Repository navigation
fix: release terminal command history when clearing the normal buffer - #326931
Merged
Dmitriy Vasyura (dmitrivMS) merged 8 commits intoOct 5, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 8 commits into
Dmitriy Vasyura (dmitrivMS) merged 8 commits into
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Updates terminal clearing to remove command-detection history and prevent retained commands and decorations.
Changes:
- Exposes viewport-clearing APIs for rich and partial command detection.
- Invokes them before clearing the xterm buffer.
- Adds partial command detection coverage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
capabilities.ts |
Adds command-clearing APIs. |
commandDetectionCapability.ts |
Exposes rich command clearing. |
partialCommandDetectionCapability.ts |
Exposes partial command clearing. |
xtermTerminal.ts |
Clears command history before the buffer. |
partialCommandDetectionCapability.test.ts |
Tests partial viewport clearing. |
# Conflicts: # src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts
# Conflicts: # src/vs/workbench/contrib/terminal/test/browser/xterm/xtermTerminal.test.ts
Dmitriy Vasyura (dmitrivMS)
requested changes
Sep 29, 2026
Dmitriy Vasyura (dmitrivMS)
left a comment
Collaborator
There was a problem hiding this comment.
Please see inline comment.
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 5, 2026
Collaborator
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
October 5, 2026 05:09
Martin Aeschlimann (aeschli)
approved these changes
Oct 5, 2026
Martin Aeschlimann (aeschli)
approved these changes
Oct 5, 2026
Giuseppe Cianci (Giuspepe)
approved these changes
Oct 5, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/clear-terminal-command-history
branch
October 5, 2026 16:33
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.

Details
Clearing the normal terminal buffer now removes the entire rich and partial command history, including commands in scrollback, and invalidates rich commands so their decorations are disposed. This prevents repeated task runs and terminal clears from retaining command history and decorations.
Cleanup follows the active buffer: clearing an alternate screen (for example, Vim or a pager) preserves the surviving normal-buffer output, command history, navigation markers, decorations, and current prompt state.
Before
When running the same task and clearing the terminal 37 times, retained commands and their decorations grow each time (outlined in red):
After
No more retained command or partial-command marker growth is detected.
Tests
Regression coverage drives
XtermTerminal.clearBuffer()with commands in scrollback and verifies rich/partial history cleanup and rich decoration disposal. An alternate-screen round trip verifies that normal-buffer text, histories, markers, decorations, and current prompt state survive.Validated after merging the latest main: