We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ce5be7 commit 8a81524Copy full SHA for 8a81524
1 file changed
richtextfx/src/main/java9/org/fxmisc/richtext/TextFlowExt.java
@@ -109,10 +109,10 @@ CharacterHit hit(double x, double y) {
109
int charIdx = hit.getCharIndex();
110
boolean leading = hit.isLeading();
111
112
- if ( ! leading ) {
+ if ( ! leading && getLineCount() > 1) {
113
// If this is a wrapped paragraph and hit character is at end of hit line, make sure that the
114
// "character hit" stays at the end of the hit line (and not at the beginning of the next line).
115
- leading = (getLineCount() > 1 && charIdx + 1 >= span.getStart() + span.getLength());
+ leading = (getLineOfCharacter(charIdx) + 1 < getLineCount() && charIdx + 1 >= span.getStart() + span.getLength());
116
}
117
118
if(x < lineBounds.getMinX() || x > lineBounds.getMaxX()) {
0 commit comments