From 2852f2320ee167939a623e269ffd69ffab932726 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 16 Nov 2023 15:12:35 +0100 Subject: [PATCH] Fix small comment input when starting collapsed + editable Fixes #197793 --- src/vs/workbench/contrib/comments/browser/commentNode.ts | 5 +++-- .../workbench/contrib/comments/browser/commentThreadBody.ts | 4 ++-- .../contrib/comments/browser/commentThreadWidget.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/comments/browser/commentNode.ts b/src/vs/workbench/contrib/comments/browser/commentNode.ts index a62d62d1c861f..496dd604aa9b4 100644 --- a/src/vs/workbench/contrib/comments/browser/commentNode.ts +++ b/src/vs/workbench/contrib/comments/browser/commentNode.ts @@ -573,8 +573,9 @@ export class CommentNode extends Disposable { this._commentEditContainer!.remove(); } - layout() { - this._commentEditor?.layout({ width: this._commentEditor.getLayoutInfo().width, height: this._editorHeight }); + layout(widthInPixel?: number) { + const editorWidth = widthInPixel !== undefined ? widthInPixel - 72 /* - margin and scrollbar*/ : (this._commentEditor?.getLayoutInfo().width ?? 0); + this._commentEditor?.layout({ width: editorWidth, height: this._editorHeight }); const scrollWidth = this._body.scrollWidth; const width = dom.getContentWidth(this._body); const scrollHeight = this._body.scrollHeight; diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadBody.ts b/src/vs/workbench/contrib/comments/browser/commentThreadBody.ts index 320c693c32a73..bf82a6522397a 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadBody.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadBody.ts @@ -122,9 +122,9 @@ export class CommentThreadBody extends D return dom.getClientArea(this.container); } - layout() { + layout(widthInPixel?: number) { this._commentElements.forEach(element => { - element.layout(); + element.layout(widthInPixel); }); } diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts index a234e880a0ef1..de118bffe70ba 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts @@ -342,7 +342,7 @@ export class CommentThreadWidget extends } layout(widthInPixel?: number) { - this._body.layout(); + this._body.layout(widthInPixel); if (widthInPixel !== undefined) { this._commentReply?.layout(widthInPixel);