dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/TextBox.cs


From: Heiko Weiss
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/TextBox.cs
Date: Fri, 03 Nov 2006 06:23:37 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Changes by:     Heiko Weiss <brubbel>   06/11/03 06:23:37

Modified files:
        .              : ChangeLog 
        System.Windows.Forms: TextBox.cs 

Log message:
        fixed index out of range exception.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2454&r2=1.2455
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Windows.Forms/TextBox.cs?cvsroot=dotgnu-pnet&r1=1.54&r2=1.55

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2454
retrieving revision 1.2455
diff -u -b -r1.2454 -r1.2455
--- ChangeLog   31 Oct 2006 18:12:19 -0000      1.2454
+++ ChangeLog   3 Nov 2006 06:23:36 -0000       1.2455
@@ -1,3 +1,7 @@
+2006-11-03  Heiko Weiss <address@hidden>
+
+       * System.Windows.Forms/TextBox.cs: fixed index out of range exception.
+
 2006-10-31  Heiko Weiss <address@hidden>
 
        * System.Xml/Serialization/XmlSerializer.cs: fixed serialization errors.

Index: System.Windows.Forms/TextBox.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Windows.Forms/TextBox.cs,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- System.Windows.Forms/TextBox.cs     13 Jul 2006 13:12:33 -0000      1.54
+++ System.Windows.Forms/TextBox.cs     3 Nov 2006 06:23:37 -0000       1.55
@@ -1126,27 +1126,34 @@
                if (prevLayout)
                {
                        Region update = new Region(RectangleF.Empty);
-                       int len = text.Length;
-                       if (oldText.Length > len)
+                       int oldLen = oldText.Length;
+                       int newLen = text.Length;
+                       int len    = newLen;
+                                       
+                       if (oldLen > len)
                        {
-                               len = oldText.Length;
+                               len = oldLen;
                        }
                        for (int i=0;i < len;i++)
                        {
-                               if (i >= oldText.Length)
+                               if (i >= oldLen)
                                {
-                                       update.Union( layout.Items[i].bounds);
+                                       if( i < newLen ) update.Union( 
layout.Items[i].bounds);
                                }
-                               else if (i >= text.Length)
+                               else if (i >= newLen )
                                {
-                                       update.Union( 
oldLayout.Items[i].bounds);
+                                       if( i < oldLen ) update.Union( 
oldLayout.Items[i].bounds);
                                }
-                               else if (Text[i] != oldText[i] || 
oldLayout.Items[i].bounds != layout.Items[i].bounds)
+                               else if ( (i < oldLen && i < newLen) && 
(Text[i] != oldText[i] || oldLayout.Items[i].bounds != layout.Items[i].bounds ) 
)
                                {
+                                       if( i < newLen ) {
                                        update.Union( layout.Items[i].bounds);
+                                       }
+                                       if( i < oldLen ) {
                                        update.Union( 
oldLayout.Items[i].bounds);
                                }
                        }
+                       }
                        // Get the offset of the TextDrawArea
                        update.Translate( - XViewOffset, - YViewOffset);
                        AddUpdate(update);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]