Author: jackson
Date: 2006-09-26 01:27:49 -0400 (Tue, 26 Sep 2006)
New Revision: 65897

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
Log:

        * TextControl.cs: When deleting characters make sure that any
        orphaned zero lengthed tags get deleted.
        - Fix ToString for zero lengthed tags.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-26 00:11:14 UTC (rev 65896)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-26 05:27:49 UTC (rev 65897)
@@ -1,3 +1,9 @@
+2006-09-26  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * TextControl.cs: When deleting characters make sure that any
+       orphaned zero lengthed tags get deleted.
+       - Fix ToString for zero lengthed tags.
+
 2006-09-25  Jackson Harper  <[EMAIL PROTECTED]>
 
        * TextControl.cs: When getting a tag at the location there can be

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2006-09-26 00:11:14 UTC (rev 65896)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2006-09-26 05:27:49 UTC (rev 65897)
@@ -2311,6 +2311,16 @@
                                }
                        }
 
+                       // Delete empty orphaned tags at the end
+                       LineTag walk = tag;
+                       while (walk != null && walk.next != null && 
walk.next.length == 0) {
+                               LineTag t = walk;
+                               walk.next = walk.next.next;
+                               if (walk.next != null)
+                                       walk.next.previous = t;
+                               walk = walk.next;
+                       }
+
                        // Adjust the start point of any tags following
                        if (tag != null) {
                                tag = tag.next;
@@ -2375,6 +2385,16 @@
                                }
                        }
 
+                       // Delete empty orphaned tags at the end
+                       LineTag walk = tag;
+                       while (walk != null && walk.next != null && 
walk.next.length == 0) {
+                               LineTag t = walk;
+                               walk.next = walk.next.next;
+                               if (walk.next != null)
+                                       walk.next.previous = t;
+                               walk = walk.next;
+                       }
+
                        tag = tag.next;
                        while (tag != null) {
                                tag.start--;
@@ -4512,7 +4532,9 @@
                }
 
                public override string ToString() {
-                       return "Tag starts at index " + this.start + "length " 
+ this.length + " text: " + this.line.Text.Substring(this.start-1, this.length) 
+ "Font " + this.font.ToString();
+                       if (length > 0)
+                               return "Tag starts at index " + this.start + 
"length " + this.length + " text: " + this.line.Text.Substring(this.start-1, 
this.length) + "Font " + this.font.ToString();
+                       return "Zero Lengthed tag at index " + this.start;
                }
 
                #endregion      // Internal Methods

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to