changeset 5569:b2401b5285d1

RT-33895: Input method composing text is not highlighted Reviewed-by: naoto
author leifs
date Tue, 29 Oct 2013 15:48:27 -0700
parents bb60b5a3afdc
children d83cbe8507e2
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TextInputControlSkin.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TextInputControlSkin.java	Tue Oct 29 12:49:50 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TextInputControlSkin.java	Tue Oct 29 15:48:27 2013 -0700
@@ -531,7 +531,9 @@
         double minY = 0f;
         double maxY = 0f;
 
-        for (PathElement pe: getUnderlineShape(start, end)) {
+        PathElement elements[] = getUnderlineShape(start, end);
+        for (int i = 0; i < elements.length; i++) {
+            PathElement pe = elements[i];
             if (pe instanceof MoveTo) {
                 minX = maxX = ((MoveTo)pe).getX();
                 minY = maxY = ((MoveTo)pe).getY();
@@ -546,7 +548,11 @@
             } else if (pe instanceof VLineTo) {
                 minY = (minY < ((VLineTo)pe).getY() ? minY : ((VLineTo)pe).getY());
                 maxY = (maxY > ((VLineTo)pe).getY() ? maxY : ((VLineTo)pe).getY());
-            } else if (pe instanceof ClosePath) {
+            }
+            // Don't assume that shapes are ended with ClosePath.
+            if (pe instanceof ClosePath ||
+                i == elements.length - 1 ||
+                (i < elements.length - 1 && elements[i+1] instanceof MoveTo)) {
                 // Now, create the attribute.
                 Shape attr = null;
                 if (highlight == InputMethodHighlight.SELECTED_RAW) {