Skip to content

Commit 6818631

Browse files
committed
Include source viewer trim in code block sizing
1 parent cfcf0bb commit 6818631

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/SourceViewerComposite.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ public Point computeSize(int widthHint, int heightHint, boolean changed) {
225225
}
226226

227227
Point textSize = textWidget.computeSize(widthHint, SWT.DEFAULT, changed);
228-
int width = widthHint == SWT.DEFAULT ? textSize.x : widthHint;
229-
int height = heightHint == SWT.DEFAULT ? getSourceViewerHeight(textWidget, textSize) : heightHint;
228+
Rectangle trim = computeTrim(0, 0, textSize.x, getSourceViewerHeight(textWidget, textSize));
229+
int width = widthHint == SWT.DEFAULT ? trim.width : widthHint;
230+
int height = heightHint == SWT.DEFAULT ? trim.height : heightHint;
230231
return new Point(Math.max(0, width), Math.max(0, height));
231232
}
232233

0 commit comments

Comments
 (0)