Skip to content

Commit d25a4bf

Browse files
committed
cleaning the code, using only an approximate indentation width
1 parent 7ab2d51 commit d25a4bf

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorWidget.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,7 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
763763
protected override _doLayout(heightInPixel: number): void {
764764

765765
const info = this.editor.getLayoutInfo();
766-
if (this.position) {
767-
const lineIndentColumn = this.editor._getViewModel()?.getLineIndentColumn(this.position.lineNumber);
768-
console.log('lineIndentColumn', lineIndentColumn);
769-
}
770-
const spaceLeft = info.lineNumbersWidth + info.glyphMarginWidth + info.decorationsWidth;
766+
const spaceLeft = info.lineNumbersWidth + info.glyphMarginWidth + info.decorationsWidth + (this._findApproximateIndentationWidth() ?? 0);
771767
const spaceRight = info.minimap.minimapWidth + info.verticalScrollbarWidth;
772768

773769
const maxWidth = !this.widget.showsAnyPreview() ? 640 : Number.MAX_SAFE_INTEGER;
@@ -779,6 +775,17 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
779775
this.widget.layout(this._dimension);
780776
}
781777

778+
private _findApproximateIndentationWidth(): number | undefined {
779+
if (!this.position) {
780+
return;
781+
}
782+
const lineIndentColumn = this.editor._getViewModel()?.getLineIndentColumn(this.position.lineNumber);
783+
if (!lineIndentColumn) {
784+
return;
785+
}
786+
return (lineIndentColumn - 1) * this.editor.getOption(EditorOption.fontSize);
787+
}
788+
782789
private _computeHeightInLines(): number {
783790
const lineHeight = this.editor.getOption(EditorOption.lineHeight);
784791
return this.widget.getHeight() / lineHeight;

0 commit comments

Comments
 (0)