You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/10/23 17:46:05 UTC

svn commit: r829098 - in /incubator/pivot/trunk/wtk: src/org/apache/pivot/wtk/skin/TextAreaSkin.java test/org/apache/pivot/wtk/text/test/document.wtkx

Author: gbrown
Date: Fri Oct 23 15:46:04 2009
New Revision: 829098

URL: http://svn.apache.org/viewvc?rev=829098&view=rev
Log:
Minor TextArea updates.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
    incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/document.wtkx

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=829098&r1=829097&r2=829098&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Fri Oct 23 15:46:04 2009
@@ -1109,7 +1109,11 @@
         if (documentView == null) {
             offset = -1;
         } else {
-            offset = documentView.getInsertionPoint(x - margin.left, y - margin.top);
+            if (documentView.getBounds().contains(x, y)) {
+                offset = documentView.getInsertionPoint(x - margin.left, y - margin.top);
+            } else {
+                offset = documentView.getCharacterCount() - 1;
+            }
         }
 
         return offset;
@@ -1427,7 +1431,7 @@
                 updateCaretBounds();
                 showCaret(textArea.isFocused());
             } else {
-                // TODO Call updateCaretBounds() (renamed to updateSelectionBounds()?)
+                // TODO Call updateCaretBounds() (rename to updateSelectionBounds())
 
                 showCaret(false);
             }
@@ -1466,20 +1470,19 @@
     }
 
     private void showCaret(boolean show) {
+        if (scheduledBlinkCursorCallback != null) {
+            scheduledBlinkCursorCallback.cancel();
+        }
+
         if (show) {
-            if (scheduledBlinkCursorCallback == null) {
-                scheduledBlinkCursorCallback =
-                    ApplicationContext.scheduleRecurringCallback(blinkCursorCallback,
-                        Platform.getCursorBlinkRate());
-            }
+            scheduledBlinkCursorCallback =
+                ApplicationContext.scheduleRecurringCallback(blinkCursorCallback,
+                    Platform.getCursorBlinkRate());
 
             // Run the callback once now to show the cursor immediately
             blinkCursorCallback.run();
         } else {
-            if (scheduledBlinkCursorCallback != null) {
-                scheduledBlinkCursorCallback.cancel();
-                scheduledBlinkCursorCallback = null;
-            }
+            scheduledBlinkCursorCallback = null;
         }
     }
 }

Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/document.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/document.wtkx?rev=829098&r1=829097&r2=829098&view=diff
==============================================================================
Binary files - no diff available.