Skip to content

Commit efe5bee

Browse files
authored
Fix small comment input when starting collapsed + editable (#198431)
Fixes #197793
1 parent 6d0b5c4 commit efe5bee

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/vs/workbench/contrib/comments/browser/commentNode.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,9 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
573573
this._commentEditContainer!.remove();
574574
}
575575

576-
layout() {
577-
this._commentEditor?.layout({ width: this._commentEditor.getLayoutInfo().width, height: this._editorHeight });
576+
layout(widthInPixel?: number) {
577+
const editorWidth = widthInPixel !== undefined ? widthInPixel - 72 /* - margin and scrollbar*/ : (this._commentEditor?.getLayoutInfo().width ?? 0);
578+
this._commentEditor?.layout({ width: editorWidth, height: this._editorHeight });
578579
const scrollWidth = this._body.scrollWidth;
579580
const width = dom.getContentWidth(this._body);
580581
const scrollHeight = this._body.scrollHeight;

src/vs/workbench/contrib/comments/browser/commentThreadBody.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ export class CommentThreadBody<T extends IRange | ICellRange = IRange> extends D
122122
return dom.getClientArea(this.container);
123123
}
124124

125-
layout() {
125+
layout(widthInPixel?: number) {
126126
this._commentElements.forEach(element => {
127-
element.layout();
127+
element.layout(widthInPixel);
128128
});
129129
}
130130

src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
342342
}
343343

344344
layout(widthInPixel?: number) {
345-
this._body.layout();
345+
this._body.layout(widthInPixel);
346346

347347
if (widthInPixel !== undefined) {
348348
this._commentReply?.layout(widthInPixel);

0 commit comments

Comments
 (0)