Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More aggressively clear viewport commands on Windows #206485

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,6 @@ class WindowsPtyHeuristics extends Disposable {

private _onCursorMoveListener = this._register(new MutableDisposable());

private _recentlyPerformedCsiJ = false;

private _tryAdjustCommandStartMarkerScheduler?: RunOnceScheduler;
private _tryAdjustCommandStartMarkerScannedLineCount: number = 0;
private _tryAdjustCommandStartMarkerPollCount: number = 0;
Expand All @@ -530,20 +528,15 @@ class WindowsPtyHeuristics extends Disposable {
super();

this._register(_terminal.parser.registerCsiHandler({ final: 'J' }, params => {
// Clear commands when the viewport is cleared
if (params.length >= 1 && (params[0] === 2 || params[0] === 3)) {
this._recentlyPerformedCsiJ = true;
this._hooks.clearCommandsInViewport();
}
// We don't want to override xterm.js' default behavior, just augment it
return false;
}));

this._register(this._capability.onBeforeCommandFinished(command => {
if (this._recentlyPerformedCsiJ) {
this._recentlyPerformedCsiJ = false;
return;
}

// For older Windows backends we cannot listen to CSI J, instead we assume running clear
// or cls will clear all commands in the viewport. This is not perfect but it's right
// most of the time.
Expand Down
Loading