Skip to content

Commit f35220f

Browse files
authored
Followcaret with selection update (#1059)
1 parent 0582484 commit f35220f

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,14 +1961,12 @@ private void followCaret() {
19611961
// the caret then the selection won't be visible. So here we check for this scenario and adjust if needed.
19621962
if ( ! isWrapText() && scrollX > 0.0 && getParagraphSelection( parIdx ).getLength() > 0 )
19631963
{
1964-
double visibleLeftX = paragrafBox.getWidth() * scrollX / 100 - getWidth() + graphicWidth;
1965-
19661964
CaretNode selectionStart = new CaretNode( "", this, getSelection().getStart() );
19671965
paragrafBox.caretsProperty().add( selectionStart );
19681966
Bounds startBounds = paragrafBox.getCaretBounds( selectionStart );
19691967
paragrafBox.caretsProperty().remove( selectionStart );
19701968

1971-
if ( startBounds.getMinX() - graphicWidth < visibleLeftX ) {
1969+
if ( startBounds.getMinX() - graphicWidth < scrollX ) {
19721970
region = extendLeft( startBounds, graphicWidth );
19731971
}
19741972
}

0 commit comments

Comments
 (0)