From 84f63bf4e54c60e40865c8c4d8002893a337fe61 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Mon, 22 Jul 2024 15:14:43 +0200 Subject: [PATCH] Fixes #221245 --- .../editor/browser/widget/diffEditor/diffEditorOptions.ts | 2 ++ .../editor/browser/widget/diffEditor/diffEditorWidget.ts | 7 ++++++- src/vs/workbench/contrib/chat/browser/codeBlockPart.ts | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/browser/widget/diffEditor/diffEditorOptions.ts b/src/vs/editor/browser/widget/diffEditor/diffEditorOptions.ts index 270a6444ff2e0..565609e24c416 100644 --- a/src/vs/editor/browser/widget/diffEditor/diffEditorOptions.ts +++ b/src/vs/editor/browser/widget/diffEditor/diffEditorOptions.ts @@ -101,6 +101,8 @@ export class DiffEditorOptions { })) .flatten() .map(this, v => !!v); + + public readonly inlineViewHideOriginalLineNumbers = this.compactMode; } function isSimpleDiff(diff: DiffState, supportsTrueDiffRendering: boolean): boolean { diff --git a/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.ts index ad1d9f638dbc5..84cf365a5254a 100644 --- a/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.ts @@ -385,8 +385,13 @@ export class DiffEditorWidget extends DelegatingEditor implements IDiffEditor { } else { gutterLeft = 0; + const shouldHideOriginalLineNumbers = this._options.inlineViewHideOriginalLineNumbers.read(reader); originalLeft = gutterWidth; - originalWidth = Math.max(5, this._editors.original.getLayoutInfo().decorationsLeft); + if (shouldHideOriginalLineNumbers) { + originalWidth = 0; + } else { + originalWidth = Math.max(5, this._editors.original.getLayoutInfo().decorationsLeft); + } modifiedLeft = gutterWidth + originalWidth; modifiedWidth = fullWidth - modifiedLeft - overviewRulerPartWidth; diff --git a/src/vs/workbench/contrib/chat/browser/codeBlockPart.ts b/src/vs/workbench/contrib/chat/browser/codeBlockPart.ts index 3dd842a992f45..d60bed6237681 100644 --- a/src/vs/workbench/contrib/chat/browser/codeBlockPart.ts +++ b/src/vs/workbench/contrib/chat/browser/codeBlockPart.ts @@ -623,9 +623,11 @@ export class CodeCompareBlockPart extends Disposable { useTrueInlineView: true, }, renderSideBySideInlineBreakpoint: 300, + renderOverviewRuler: false, compactMode: true, hideUnchangedRegions: { enabled: true, contextLineCount: 1 }, renderGutterMenu: false, + lineNumbersMinChars: 1, ...options }, { originalEditor: widgetOptions, modifiedEditor: widgetOptions })); }