Skip to content

Commit

Permalink
Clear progress state when any command finishes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Jan 9, 2025
1 parent f53e4ea commit 86b257e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSl
import { XtermAddonImporter } from './xtermAddonImporter.js';
import { equals } from '../../../../../base/common/objects.js';
import type { IProgressState } from '@xterm/addon-progress';
import type { CommandDetectionCapability } from '../../../../../platform/terminal/common/capabilities/commandDetectionCapability.js';

const enum RenderConstants {
SmoothScrollDuration = 125
Expand Down Expand Up @@ -305,6 +306,18 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
};
this._register(progressAddon.onChange(() => updateProgress()));
updateProgress();
const commandDetection = this._capabilities.get(TerminalCapability.CommandDetection);
if (commandDetection) {
commandDetection.onCommandFinished(() => progressAddon.progress = { state: 0, value: 0 });
} else {
const disposable = this._capabilities.onDidAddCapability(e => {
if (e.id === TerminalCapability.CommandDetection) {
(e.capability as CommandDetectionCapability).onCommandFinished(() => progressAddon.progress = { state: 0, value: 0 });
this._store.delete(disposable);
}
});
this._store.add(disposable);
}
});

this._anyTerminalFocusContextKey = TerminalContextKeys.focusInAny.bindTo(contextKeyService);
Expand Down

0 comments on commit 86b257e

Please sign in to comment.