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;