From a5fabc665be6c92ab5e4537c91347a661f8a4918 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 07:47:49 -0700 Subject: [PATCH 1/5] fix #186904 --- .../accessibility/browser/textAreaSyncAddon.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index 9916a6f60d0..c779eef46dc 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -100,9 +100,9 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - if (!!currentCommand.commandStartX) { - this._currentCommand = commandLine.substring(currentCommand.commandStartX); - this._cursorX = buffer.cursorX - currentCommand.commandStartX; + if (!!currentCommand) { + this._currentCommand = commandLine.substring(currentCommand.commandStartX ?? 0); + this._cursorX = buffer.cursorX - (currentCommand.commandStartX ?? 0); } else { this._currentCommand = undefined; this._cursorX = undefined; From 9637c47fdc5498a5206470ea36e28977bf271f56 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Thu, 31 Aug 2023 08:03:54 -0700 Subject: [PATCH 2/5] check if mac --- .../accessibility/browser/textAreaSyncAddon.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index c779eef46dc..5c6d8579ac3 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -10,6 +10,7 @@ import { ITerminalLogService } from 'vs/platform/terminal/common/terminal'; import type { Terminal, ITerminalAddon } from 'xterm'; import { debounce } from 'vs/base/common/decorators'; import { addDisposableListener } from 'vs/base/browser/dom'; +import { isMacintosh } from 'vs/base/common/platform'; export interface ITextAreaData { content: string; @@ -100,9 +101,10 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - if (!!currentCommand) { - this._currentCommand = commandLine.substring(currentCommand.commandStartX ?? 0); - this._cursorX = buffer.cursorX - (currentCommand.commandStartX ?? 0); + const startX = isMacintosh ? currentCommand.commandStartX : 0; + if (!!currentCommand && !!startX) { + this._currentCommand = commandLine.substring(startX); + this._cursorX = buffer.cursorX - startX; } else { this._currentCommand = undefined; this._cursorX = undefined; From 68a8e14d305982c6468019082454681a1bd76c76 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 08:43:49 -0700 Subject: [PATCH 3/5] fix issue --- .../accessibility/browser/textAreaSyncAddon.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index 5c6d8579ac3..8e6e18b28e5 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -101,8 +101,8 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - const startX = isMacintosh ? currentCommand.commandStartX : 0; - if (!!currentCommand && !!startX) { + const startX = isMacintosh || currentCommand.commandStartX !== undefined ? currentCommand.commandStartX : 0; + if (!!currentCommand && startX !== undefined) { this._currentCommand = commandLine.substring(startX); this._cursorX = buffer.cursorX - startX; } else { From 6ca26d992b6de880cae1e5eb975ce88582260caa Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 09:08:40 -0700 Subject: [PATCH 4/5] different udf check --- .../accessibility/browser/textAreaSyncAddon.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts index 8e6e18b28e5..b5e800a788d 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -10,7 +10,6 @@ import { ITerminalLogService } from 'vs/platform/terminal/common/terminal'; import type { Terminal, ITerminalAddon } from 'xterm'; import { debounce } from 'vs/base/common/decorators'; import { addDisposableListener } from 'vs/base/browser/dom'; -import { isMacintosh } from 'vs/base/common/platform'; export interface ITextAreaData { content: string; @@ -101,10 +100,9 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - const startX = isMacintosh || currentCommand.commandStartX !== undefined ? currentCommand.commandStartX : 0; - if (!!currentCommand && startX !== undefined) { - this._currentCommand = commandLine.substring(startX); - this._cursorX = buffer.cursorX - startX; + if (currentCommand?.commandStartX !== undefined) { + this._currentCommand = commandLine.substring(currentCommand.commandStartX); + this._cursorX = buffer.cursorX - currentCommand.commandStartX; } else { this._currentCommand = undefined; this._cursorX = undefined; From a3d842ed4d190fbcf30d2c76460379cd8bab8b50 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Thu, 31 Aug 2023 09:29:53 -0700 Subject: [PATCH 5/5] Update src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com> --- .../terminalContrib/accessibility/browser/textAreaSyncAddon.ts | 2 +- 1 file changed, 1 insertion(+), 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 b5e800a788d..33d4b52e956 100644 --- a/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts +++ b/src/vs/workbench/contrib/terminalContrib/accessibility/browser/textAreaSyncAddon.ts @@ -100,7 +100,7 @@ export class TextAreaSyncAddon extends Disposable implements ITerminalAddon { this._logService.debug(`TextAreaSyncAddon#updateCommandAndCursor: no line`); return; } - if (currentCommand?.commandStartX !== undefined) { + if (currentCommand.commandStartX !== undefined) { this._currentCommand = commandLine.substring(currentCommand.commandStartX); this._cursorX = buffer.cursorX - currentCommand.commandStartX; } else {