6849232: closed/javax/swing/text/GlyphPainter2/6427244/bug6427244.java fails on RHEL5
authorrupashka
Wed, 06 Apr 2011 20:36:22 +0400
changeset 9216 d102bd3f513c
parent 9215 cab45ca6ab44
child 9217 f795ef267353
6849232: closed/javax/swing/text/GlyphPainter2/6427244/bug6427244.java fails on RHEL5 Reviewed-by: peterz
jdk/src/share/classes/javax/swing/text/GlyphPainter2.java
--- a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Wed Apr 06 15:12:33 2011 +0400
+++ b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Wed Apr 06 20:36:22 2011 +0400
@@ -172,6 +172,11 @@
         //italic carets and we do not.
         TextHitInfo hit = layout.hitTestChar(x - (float)alloc.getX(), 0);
         int pos = hit.getInsertionIndex();
+
+        if (pos == v.getEndOffset()) {
+            pos--;
+        }
+
         biasReturn[0] = hit.isLeadingEdge() ? Position.Bias.Forward : Position.Bias.Backward;
         return pos + v.getStartOffset();
     }