Skip to content

Commit e07cc2a

Browse files
authored
Merge pull request microsoft#152136 from microsoft/tyriar/151228
Try prevent duplicate placeholder decorations showing
2 parents 8332665 + adf9340 commit e07cc2a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ export class CommandDetectionCapability implements ICommandDetectionCapability {
297297
}
298298

299299
handleCommandStart(): void {
300+
// Only update the column if the line has already been set
301+
if (this._currentCommand.commandStartMarker?.line === this._terminal.buffer.active.cursorY) {
302+
this._currentCommand.commandStartX = this._terminal.buffer.active.cursorX;
303+
this._logService.debug('CommandDetectionCapability#handleCommandStart', this._currentCommand.commandStartX, this._currentCommand.commandStartMarker?.line);
304+
return;
305+
}
300306
if (this._isWindowsPty) {
301307
this._handleCommandStartWindows();
302308
return;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
215215
if (!decoration) {
216216
return undefined;
217217
}
218-
218+
if (beforeCommandExecution) {
219+
this._placeholderDecoration = decoration;
220+
}
219221
decoration.onRender(element => {
220222
if (element.classList.contains(DecorationSelector.OverviewRuler)) {
221223
return;
222224
}
223-
if (beforeCommandExecution && !this._placeholderDecoration) {
224-
this._placeholderDecoration = decoration;
225-
} else if (!this._decorations.get(decoration.marker.id)) {
225+
if (!this._decorations.get(decoration.marker.id)) {
226226
decoration.onDispose(() => this._decorations.delete(decoration.marker.id));
227227
this._decorations.set(decoration.marker.id,
228228
{

0 commit comments

Comments
 (0)