Skip to content

Commit 36b13d6

Browse files
authored
Fix minimum paragraph width (#1242)
1 parent 57f70b2 commit 36b13d6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,15 @@ protected double computePrefHeight(double width) {
250250
protected void layoutChildren() {
251251
Insets ins = getInsets();
252252
double h = getHeight() - ins.getTop() - ins.getBottom();
253+
double w = getWidth() - ins.getLeft() - ins.getRight();
253254
double graphicWidth = getGraphicPrefWidth();
254255

255256
if ( wrapText.get() ) {
256257
double half = text.getLineSpacing() / 2.0;
257-
double w = getWidth() - ins.getLeft() - ins.getRight();
258258
text.resizeRelocate(graphicWidth + ins.getLeft(), ins.getTop() + half, w - graphicWidth, h - half);
259259
} else {
260260
text.relocate( graphicWidth + ins.getLeft(), ins.getTop() );
261+
text.setMinWidth( w - graphicWidth );
261262
text.autosize();
262263
}
263264

0 commit comments

Comments
 (0)