Author: max
Date: 2008-03-06 14:15:12 -0800 (Thu, 06 Mar 2008)
New Revision: 8202

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
Log:
Change 20080306-maxcarlson-k by [EMAIL PROTECTED] on 2008-03-06 13:08:28 PST
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Reset selection when when selection position is out of bounds

New Features:

Bugs Fixed: LPP-5449 - Seems like inputtext selection position is not reset 
until input text is focused or setSelection() is invoked

Technical Reviewer: promanik
QA Reviewer: [EMAIL PROTECTED]
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzTextSprite.as - Track selection position in setSelection.  If the 
string passed to setText() is smaller than the selection, reset the selection.

LzInputTextSprite.as - If the string passed to setText() is smaller than the 
selection, reset the selection.
    

Tests: See LPP-5449



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as    
2008-03-06 21:59:05 UTC (rev 8201)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as    
2008-03-06 22:15:12 UTC (rev 8202)
@@ -298,6 +298,7 @@
   * @param String t: the string to which to set the text
   */
 LzInputTextSprite.prototype.setText = function ( t ){
+    // Keep in sync with LzTextSprite.setText()
     //Debug.write('LzInputTextSprite.setText', this, t);
     if (typeof(t) == 'undefined' || t == null) {
         t = "";
@@ -331,6 +332,12 @@
         LzIdle.callOnIdle(scrolldel);
     }
 
+    // Fix for lpp-5449
+    var l = t.length;
+    if (this._selectionstart > l || this._selectionend > l) {
+        this.setSelection(l);
+    }
+
     //@event ontext: Sent whenever the text in the field changes.
     //this.owner.ontext.sendEvent(t);
 }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as 2008-03-06 
21:59:05 UTC (rev 8201)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as 2008-03-06 
22:15:12 UTC (rev 8202)
@@ -1,7 +1,7 @@
 /**
   * LzTextSprite.as
   *
-  * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic Kernel
@@ -461,6 +461,7 @@
   * @param String t: the string to which to set the text
   */
 LzTextSprite.prototype.setText = function ( t ){
+    // Keep in sync with LzTextSprite.setText()
     if (typeof(t) == 'undefined' || t == 'null') {
         t = "";
     } else if (typeof(t) != "string") {
@@ -496,6 +497,12 @@
         LzIdle.callOnIdle(scrolldel);
     }
 
+    // Fix for lpp-5449
+    var l = t.length;
+    if (this._selectionstart > l || this._selectionend > l) {
+        this.setSelection(l);
+    }
+
     //@event ontext: Sent whenever the text in the field changes.
     //this.ontext.sendEvent( );
 }
@@ -800,6 +807,10 @@
         end = start;
     }
 
+    // Fix for lpp-5449
+    this._selectionstart = start;
+    this._selectionend = end;
+
     Selection.setSelection( start , end );
 }
 


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to