Skip to content

Commit 75577f9

Browse files
committed
Fix height paragraph box height calculation
The insets were removed from the "overhead" when they should have been added. This was asking the text for its preferred height if it had (width + insets) space, rather than (width - insets). Because of this, some paragraphs give a preferred height of one line less than they should (because they wouldn't need to wrap given the extra space that's actually occupied by the insets). Closes #809
1 parent 94a7ee7 commit 75577f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ protected double computePrefWidth(double ignoredHeight) {
228228
@Override
229229
protected double computePrefHeight(double width) {
230230
Insets insets = getInsets();
231-
double overhead = getGraphicPrefWidth() - insets.getLeft() - insets.getRight();
231+
double overhead = getGraphicPrefWidth() + insets.getLeft() + insets.getRight();
232232
return text.prefHeight(width - overhead) + insets.getTop() + insets.getBottom();
233233
}
234234

0 commit comments

Comments
 (0)