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/09 16:04:19 UTC

svn commit: r995435 - in /pivot/trunk: tests/src/org/apache/pivot/tests/text_area_test.bxml wtk/src/org/apache/pivot/wtk/TextArea2.java

Author: gbrown
Date: Thu Sep  9 14:04:19 2010
New Revision: 995435

URL: http://svn.apache.org/viewvc?rev=995435&view=rev
Log:
TextAreaSkin2 updates.

Modified:
    pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea2.java

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml?rev=995435&r1=995434&r2=995435&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml Thu Sep  9 14:04:19 2010
@@ -28,8 +28,20 @@ limitations under the License.
 
     <BoxPane orientation="vertical" styles="{padding:8}">
         <Border>
-            <TextArea2 bxml:id="textArea" text="@sample.txt" preferredWidth="320"
-                styles="{margin:8, backgroundColor:'#eeeeee', wrapText:true, horizontalAlignment:'left'}"/>
+            <TextArea2 bxml:id="textArea" text="abc&#x000A;def&#x000A;g" preferredWidth="320"
+                styles="{margin:8, backgroundColor:'#eeeeee', wrapText:true, horizontalAlignment:'left'}">
+                <textAreaContentListeners>
+                function textChanged(textArea) {
+                    java.lang.System.out.println("length = " + textArea.characterCount);
+                }
+                </textAreaContentListeners>
+
+                <textAreaSelectionListeners>
+                function selectionChanged(textArea, previousSelectionStart, previousSelectionLength) {
+                    java.lang.System.out.println(textArea.selectionStart + ", " + textArea.selectionLength);
+                }
+                </textAreaSelectionListeners>
+            </TextArea2>
         </Border>
     </BoxPane>
 </Window>

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=995435&r1=995434&r2=995435&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea2.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea2.java Thu Sep  9 14:04:19 2010
@@ -392,7 +392,8 @@ public class TextArea2 extends Component
                 // Update selection state
                 int previousSelectionStart = selectionStart;
                 int previousSelectionLength = selectionLength;
-                selectionStart = (paragraphs.getLength() > 0) ? paragraphs.get(index).offset : 0;
+                selectionStart = (index == paragraphs.getLength()) ?
+                    TextArea2.this.characterCount : paragraphs.get(index).offset;
                 selectionLength = 0;
 
                 // Fire change events
@@ -748,7 +749,7 @@ public class TextArea2 extends Component
     }
 
     private void updateParagraphOffsets(int from, int count) {
-        if (count > 0) {
+        if (count != 0) {
             for (int i = from, n = paragraphs.getLength(); i < n; i++) {
                 Paragraph paragraph = paragraphs.get(i);
                 paragraph.offset += count;