Author: jackson
Date: 2007-03-29 11:57:25 -0500 (Thu, 29 Mar 2007)
New Revision: 75154

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 text from non multiline
        * textboxes,
        we need to update the entire document, because line offsets will
        be shifting.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-03-29 16:56:21 UTC (rev 75153)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-03-29 16:57:25 UTC (rev 75154)
@@ -1,3 +1,9 @@
+2007-03-29  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * TextControl.cs: When deleting text from non multiline textboxes,
+       we need to update the entire document, because line offsets will
+       be shifting.
+
 2007-03-29  Everaldo Canuto  <[EMAIL PROTECTED]>
 
        * XplatUIX11.cs, ThemeWin32Classic.cs, Theme.cs: ShowBalloonWindow 
method

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2007-03-29 16:56:21 UTC (rev 75153)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2007-03-29 16:57:25 UTC (rev 75154)
@@ -514,7 +514,7 @@
                        int     len;
                        SizeF   size;
                        float   w;
-                       int     prev_height;
+                       int     prev_offset;
                        bool    retval;
                        bool    wrapped;
                        Line    line;
@@ -523,7 +523,7 @@
                        pos = 0;
                        len = this.text.Length;
                        tag = this.tags;
-                       prev_height = this.height;      // For drawing 
optimization calculations
+                       prev_offset = this.offset;      // For drawing 
optimization calculations
                        this.height = 0;                // Reset line height
                        this.ascent = 0;                // Reset the ascent for 
the line
                        tag.shift = 0;
@@ -643,7 +643,7 @@
                                tag.height = this.height;
                        }
 
-                       if (prev_height != this.height) {
+                       if (prev_offset != offset) {
                                retval = true;
                        }
                        return retval;
@@ -2504,9 +2504,24 @@
                        }
 
                Cleanup:
-                       if (pos >= line.TextLengthWithoutEnding ())
-                               GetLineEnding (line.text.ToString (), 0, out 
line.ending);
-                       UpdateView(line, pos);
+                       if (pos >= line.TextLengthWithoutEnding ()) {
+                               LineEnding ending = line.ending;
+                               GetLineEnding (line.text.ToString (), 0, out 
ending);
+                               if (ending != line.ending) {
+                                       line.ending = ending;
+
+                                       if (!multiline) {
+                                               UpdateView (line, lines, pos);
+                                               owner.Invalidate ();
+                                               return;
+                                       }
+                               }
+                       }
+                       if (!multiline) {
+                               UpdateView (line, lines, pos);
+                               owner.Invalidate ();
+                       } else 
+                               UpdateView(line, pos);
                }
 
                // Deletes a character at or after the given position 
(depending on forward); it will not delete past line limits
@@ -2577,9 +2592,24 @@
                        }
 
                Cleanup:
-                       if (pos >= line.TextLengthWithoutEnding ())
-                               GetLineEnding (line.text.ToString (), 0, out 
line.ending);
-                       UpdateView(line, pos);
+                       if (pos >= line.TextLengthWithoutEnding ()) {
+                               LineEnding ending = line.ending;
+                               GetLineEnding (line.text.ToString (), 0, out 
ending);
+                               if (ending != line.ending) {
+                                       line.ending = ending;
+
+                                       if (!multiline) {
+                                               UpdateView (line, lines, pos);
+                                               owner.Invalidate ();
+                                               return;
+                                       }
+                               }
+                       }
+                       if (!multiline) {
+                               UpdateView (line, lines, pos);
+                               owner.Invalidate ();
+                       } else 
+                               UpdateView(line, pos);
                }
 
                // Combine two lines

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

Reply via email to