From 5f4b08ff09b614bfc7bf564f6d2c634d28f82371 Mon Sep 17 00:00:00 2001 From: "jose.pereda" Date: Tue, 12 Nov 2024 18:16:33 +0100 Subject: [PATCH] set caret unmanaged --- .../main/java/com/gluonhq/richtextarea/ParagraphTile.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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