diff --git a/rta/src/main/java/com/gluonhq/richtextarea/ParagraphTile.java b/rta/src/main/java/com/gluonhq/richtextarea/ParagraphTile.java index 9c0450b..fc9d958 100644 --- a/rta/src/main/java/com/gluonhq/richtextarea/ParagraphTile.java +++ b/rta/src/main/java/com/gluonhq/richtextarea/ParagraphTile.java @@ -382,6 +382,7 @@ public Layer(int start, int end, boolean isTableCell) { textFlow.setOnMousePressed(this::mousePressedListener); caretShape.setFocusTraversable(false); + caretShape.setManaged(false); caretShape.getStyleClass().add("caret"); selectionShape.getStyleClass().setAll("selection"); textBackgroundColorPaths.addListener(this::updateLayer); @@ -393,9 +394,7 @@ public Layer(int start, int end, boolean isTableCell) { @Override protected double computePrefHeight(double width) { - // take into account caret height: whether it is visible or not, - // the layer's height doesn't change - return Math.max(caretShape.getLayoutBounds().getHeight(), textFlow.prefHeight(textFlow.getPrefWidth()) + 1); + return textFlow.prefHeight(textFlow.getPrefWidth()) + 1; } @Override