Skip to content

Commit 2be6e50

Browse files
authored
Remove stale decoration when running watch activities (microsoft#257482)
* Figure out way to remove stale decoration * Dont re-register decoration when ctrl+c to prevent stale decoration * clean up * Cleaner code * Use cursorY >= command start marker * see if better handling incomplete command help * does using marker vs. promptStartMarker work? * use baseY + * Clean code * english error
1 parent 07964ed commit 2be6e50

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,20 @@ export class DecorationAddon extends Disposable implements ITerminalAddon, IDeco
221221
this.registerCommandDecoration(command);
222222
}
223223
commandDetectionListeners.push(capability.onCommandFinished(command => {
224-
this.registerCommandDecoration(command);
224+
const buffer = this._terminal?.buffer?.active;
225+
const marker = command.promptStartMarker;
226+
227+
// Edge case: Handle case where tsc watch commands clears buffer, but decoration of that tsc command re-appears
228+
const shouldRegisterDecoration = (
229+
command.exitCode === undefined ||
230+
// Only register decoration if the cursor is at or below the promptStart marker.
231+
(buffer && marker && buffer.baseY + buffer.cursorY >= marker.line)
232+
);
233+
234+
if (shouldRegisterDecoration) {
235+
this.registerCommandDecoration(command);
236+
}
237+
225238
if (command.exitCode) {
226239
this._accessibilitySignalService.playSignal(AccessibilitySignal.terminalCommandFailed);
227240
} else {

0 commit comments

Comments
 (0)