Skip to content

Commit c4a3616

Browse files
authored
Merge pull request microsoft#188012 from yshaojun/fix/175397
fix: modified editor width(microsoft#175397)
2 parents 53e7651 + d79974f commit c4a3616

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
13691369
this._originalDomNode.style.width = splitPoint + 'px';
13701370
this._originalDomNode.style.left = '0px';
13711371

1372-
this._modifiedDomNode.style.width = (width - splitPoint) + 'px';
1372+
this._modifiedDomNode.style.width = (width - splitPoint - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH) + 'px';
13731373
this._modifiedDomNode.style.left = splitPoint + 'px';
13741374

13751375
this._overviewDomElement.style.top = '0px';

src/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,19 +252,16 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
252252
const sashLeft = this._sash.read(reader)?.sashLeft.read(reader);
253253

254254
const originalWidth = sashLeft ?? Math.max(5, this._editors.original.getLayoutInfo().decorationsLeft);
255+
const modifiedWidth = width - originalWidth - (this._options.renderOverviewRuler.read(reader) ? OverviewRulerPart.ENTIRE_DIFF_OVERVIEW_WIDTH : 0);
255256

256257
this.elements.original.style.width = originalWidth + 'px';
257258
this.elements.original.style.left = '0px';
258259

259-
this.elements.modified.style.width = (width - originalWidth) + 'px';
260+
this.elements.modified.style.width = modifiedWidth + 'px';
260261
this.elements.modified.style.left = originalWidth + 'px';
261262

262-
this._editors.original.layout({ width: originalWidth, height: height });
263-
this._editors.modified.layout({
264-
width: width - originalWidth -
265-
(this._options.renderOverviewRuler.read(reader) ? OverviewRulerPart.ENTIRE_DIFF_OVERVIEW_WIDTH : 0),
266-
height
267-
});
263+
this._editors.original.layout({ width: originalWidth, height });
264+
this._editors.modified.layout({ width: modifiedWidth, height });
268265

269266
return {
270267
modifiedEditor: this._editors.modified.getLayoutInfo(),

0 commit comments

Comments
 (0)