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 2010/09/10 23:09:09 UTC

svn commit: r995985 - in /pivot/trunk/wtk/src/org/apache/pivot/wtk: TextArea2.java skin/TextAreaSkin2.java

Author: gbrown
Date: Fri Sep 10 21:09:09 2010
New Revision: 995985

URL: http://svn.apache.org/viewvc?rev=995985&view=rev
Log:
TextArea2 fixes.

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

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea2.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea2.java?rev=995985&r1=995984&r2=995985&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea2.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea2.java Fri Sep 10 21:09:09 2010
@@ -393,8 +393,6 @@ public class TextArea2 extends Component
                 // Update selection state
                 int previousSelectionStart = selectionStart;
                 int previousSelectionLength = selectionLength;
-
-                // TODO Investigate issue with setting selection to end of paragraph
                 selectionStart = (index == paragraphs.getLength()) ?
                     TextArea2.this.characterCount : paragraphs.get(index).offset;
                 selectionLength = 0;
@@ -741,12 +739,10 @@ public class TextArea2 extends Component
             } else {
                 // The removal spans paragraphs; remove any intervening paragraphs and
                 // merge the leading and trailing segments
-                String trailingText = endParagraph.characters.substring((index + count) - endParagraph.offset);
-
-                paragraphSequence.remove(beginParagraphIndex + 1, endParagraphIndex - beginParagraphIndex);
-
-                beginParagraph.removeText(index - beginParagraph.offset);
-                beginParagraph.insertText(trailingText, beginParagraph.characters.length());
+                String leadingText = beginParagraph.characters.substring(0, index - beginParagraph.offset);
+                endParagraph.removeText(0, (index + count) - endParagraph.offset);
+                paragraphSequence.remove(beginParagraphIndex, endParagraphIndex - beginParagraphIndex);
+                endParagraph.insertText(leadingText, 0);
             }
         }
     }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin2.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin2.java?rev=995985&r1=995984&r2=995985&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin2.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin2.java Fri Sep 10 21:09:09 2010
@@ -822,6 +822,7 @@ public class TextAreaSkin2 extends Compo
             } else {
                 textArea.setSelection(0, 0);
             }
+
             scrollCharacterToVisible(0);
 
             consumed = true;
@@ -836,6 +837,7 @@ public class TextAreaSkin2 extends Compo
             } else {
                 textArea.setSelection(textArea.getCharacterCount() - 1, 0);
             }
+
             scrollCharacterToVisible(textArea.getCharacterCount() - 1);
 
             consumed = true;