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/27 20:32:25 UTC

svn commit: r830308 - in /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk: TextArea.java skin/TextAreaSkin.java

Author: gbrown
Date: Tue Oct 27 19:32:25 2009
New Revision: 830308

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

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

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java?rev=830308&r1=830307&r2=830308&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java Tue Oct 27 19:32:25 2009
@@ -399,7 +399,7 @@
      */
     public void setSelection(int selectionStart, int selectionLength) {
         if (document == null) {
-            throw new IllegalStateException("No document.");
+            throw new IllegalStateException();
         }
 
         if (selectionLength < 0) {
@@ -436,7 +436,7 @@
         }
 
         if (document == null) {
-            throw new IllegalStateException("No document.");
+            throw new IllegalStateException();
         }
 
         if (selectionLength > 0) {
@@ -489,7 +489,7 @@
         }
 
         if (document == null) {
-            throw new IllegalStateException("No document.");
+            throw new IllegalStateException();
         }
 
         if (selectionLength > 0) {
@@ -506,7 +506,7 @@
 
     public void insertParagraph() {
         if (document == null) {
-            throw new IllegalStateException("No document.");
+            throw new IllegalStateException();
         }
 
         if (selectionLength > 0) {
@@ -540,7 +540,7 @@
         }
 
         if (document == null) {
-            throw new IllegalStateException("No document.");
+            throw new IllegalStateException();
         }
 
         if (selectionLength > 0) {

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=830308&r1=830307&r2=830308&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 Tue Oct 27 19:32:25 2009
@@ -725,9 +725,7 @@
                 // Ensure that the paragraph is visible even when empty
                 height = Math.max(height, terminatorBounds.height);
 
-                // TODO Don't hard-code padding; use the value specified
-                // by the Paragraph
-                setSize(breakWidth, height + 2);
+                setSize(breakWidth, height);
             }
 
             super.validate();
@@ -1901,10 +1899,11 @@
                     } else {
                         // Clear the selection and move the caret forward by one
                         // character
-                        selectionStart += selectionLength;
+                        if (selectionLength > 0) {
+                            selectionStart += selectionLength - 1;
+                        }
 
-                        if (selectionLength == 0
-                            && selectionStart < document.getCharacterCount() - 1) {
+                        if (selectionStart < document.getCharacterCount() - 1) {
                             selectionStart++;
                         }