Skip to content

Commit 77086ab

Browse files
Merge pull request #500 from twistedsquare/selection-fix
Fixes issue #499: calling getCharacterBoundsOnScreen on a paragraph w…
2 parents d67fc82 + 944a701 commit 77086ab

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ public Bounds getRangeBoundsOnScreen(int from, int to) {
156156
PathElement[] rangeShape = getRangeShape(from, to);
157157

158158
// switch out shapes to calculate the bounds on screen
159-
List<PathElement> selShape = selectionShape.getElements();
159+
// Must take a copy of the list contents, not just a reference:
160+
List<PathElement> selShape = new ArrayList<>(selectionShape.getElements());
160161
selectionShape.getElements().setAll(rangeShape);
161162
Bounds localBounds = selectionShape.getBoundsInLocal();
162163
Bounds rangeBoundsOnScreen = selectionShape.localToScreen(localBounds);

0 commit comments

Comments
 (0)