You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/03/14 14:53:31 UTC

svn commit: r1081377 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java

Author: noelgrandin
Date: Mon Mar 14 13:53:31 2011
New Revision: 1081377

URL: http://svn.apache.org/viewvc?rev=1081377&view=rev
Log:
PIVOT-684 Clicking on unused space following the last character in a TextArea should move the caret to after the last character

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=1081377&r1=1081376&r2=1081377&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Mon Mar 14 13:53:31 2011
@@ -39,8 +39,8 @@ import org.apache.pivot.wtk.Keyboard;
 import org.apache.pivot.wtk.Mouse;
 import org.apache.pivot.wtk.Platform;
 import org.apache.pivot.wtk.TextArea;
-import org.apache.pivot.wtk.TextAreaListener;
 import org.apache.pivot.wtk.TextAreaContentListener;
+import org.apache.pivot.wtk.TextAreaListener;
 import org.apache.pivot.wtk.TextAreaSelectionListener;
 import org.apache.pivot.wtk.Theme;
 
@@ -302,13 +302,14 @@ public class TextAreaSkin extends Compon
         int index = -1;
 
         if (paragraphViews.getLength() > 0) {
-            if (y > getHeight() - margin.bottom) {
-                // Select the character at x in the first row
+            TextAreaSkinParagraphView lastParagraphView = paragraphViews.get(paragraphViews.getLength() - 1);
+            if (y > lastParagraphView.getY() + lastParagraphView.getHeight()) {
+                // Select the character at x in the last row
                 TextAreaSkinParagraphView paragraphView = paragraphViews.get(paragraphViews.getLength() - 1);
                 index = paragraphView.getNextInsertionPoint(x, -1, TextArea.ScrollDirection.UP)
                     + paragraphView.getParagraph().getOffset();
             } else if (y < margin.top) {
-                // Select the character at x in the last row
+                // Select the character at x in the first row
                 TextAreaSkinParagraphView paragraphView = paragraphViews.get(0);
                 index = paragraphView.getNextInsertionPoint(x, -1, TextArea.ScrollDirection.DOWN);
             } else {