From f630e820ad2ef44f86126cf832d5593897dc6e0f Mon Sep 17 00:00:00 2001 From: Jurgen Date: Mon, 17 Aug 2020 16:36:21 +0200 Subject: [PATCH] Follow caret show complete line fix (#947) --- .../java/org/fxmisc/richtext/GenericStyledArea.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java index aec90836f..2f09d975a 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java @@ -1750,6 +1750,16 @@ private void followCaret() { } } + // Addresses https://github.com/FXMisc/RichTextFX/issues/937#issuecomment-674319602 + if ( parIdx == getParagraphs().size()-1 && cell.getNode().getLineCount() == 1 ) + { + region = new BoundingBox // Correcting the region's height + ( + region.getMinX(), region.getMinY(), region.getWidth(), + cell.getNode().getLayoutBounds().getHeight() + ); + } + virtualFlow.show(parIdx, region); }