From f28c508df8596fc05e6e09f54c2706e0084ee4ea Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:28:04 -0700 Subject: [PATCH 1/2] Clear cursor and ghost text when setting command line via sequence --- .../common/capabilities/commandDetection/promptInputModel.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts b/src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts index 4c8797d1302..02e4217b87f 100644 --- a/src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts +++ b/src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts @@ -114,6 +114,8 @@ export class PromptInputModel extends Disposable implements IPromptInputModel { setConfidentCommandLine(value: string): void { if (this._value !== value) { this._value = value; + this._cursorIndex = -1; + this._ghostTextIndex = -1; this._onDidChangeInput.fire(this._createStateObject()); } } @@ -159,7 +161,6 @@ export class PromptInputModel extends Disposable implements IPromptInputModel { this._onDidInterrupt.fire(event); } - this._state = PromptInputState.Execute; this._onDidFinishInput.fire(event); this._onDidChangeInput.fire(event); From 70889652cce1a9292107634ce84aee099de8be37 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:46:57 -0700 Subject: [PATCH 2/2] Enforce maximum adjust marker poll count Fixes #210780 --- .../common/capabilities/commandDetectionCapability.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts index fe081481c8b..83a94d50cad 100644 --- a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts @@ -555,7 +555,7 @@ class UnixPtyHeuristics extends Disposable { const enum AdjustCommandStartMarkerConstants { MaxCheckLineCount = 10, Interval = 20, - MaximumPollCount = 50, + MaximumPollCount = 10, } /** @@ -736,7 +736,7 @@ class WindowsPtyHeuristics extends Disposable { } if (scannedLineCount < AdjustCommandStartMarkerConstants.MaxCheckLineCount) { this._tryAdjustCommandStartMarkerScannedLineCount = scannedLineCount; - if (this._tryAdjustCommandStartMarkerPollCount < AdjustCommandStartMarkerConstants.MaximumPollCount) { + if (++this._tryAdjustCommandStartMarkerPollCount < AdjustCommandStartMarkerConstants.MaximumPollCount) { this._tryAdjustCommandStartMarkerScheduler?.schedule(); } else { this._flushPendingHandleCommandStartTask();