From 173c8faf3bb083572c2307ecb4e1e2d6a28b1b2a Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Tue, 10 Oct 2023 11:45:13 -0700 Subject: [PATCH] fix #195195 --- .../accessibility/browser/textAreaSyncAddon.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index 2f9cda97bee..27790254450 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -103,7 +103,9 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { } if (currentCommand.commandStartX !== undefined) { this._currentCommand = commandLine.substring(currentCommand.commandStartX); - this._cursorX = buffer.cursorX - currentCommand.commandStartX; + const cursorPosition = buffer.cursorX - currentCommand.commandStartX; + this._cursorX = cursorPosition >= 0 ? cursorPosition : 0; + this._logService.debug('cursor', this._cursorX); } else { this._currentCommand = undefined; this._cursorX = undefined;