Author: jackson
Date: 2007-03-26 15:19:37 -0500 (Mon, 26 Mar 2007)
New Revision: 74989

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

        * RichTextBox.cs: The selection_start and selection_end don't
        really track the correct tags for the selection. So we'll
manually
        compute the correct tag here.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-03-26 18:50:31 UTC (rev 74988)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-03-26 20:19:37 UTC (rev 74989)
@@ -1,3 +1,9 @@
+2007-03-26  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * RichTextBox.cs: The selection_start and selection_end don't
+       really track the correct tags for the selection. So we'll manually
+       compute the correct tag here.
+
 2007-03-26  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
        * ProgressBar.cs, ThemeWin32Classic.cs: Implemented drawing of Marquee

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs   
2007-03-26 18:50:31 UTC (rev 74988)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs   
2007-03-26 20:19:37 UTC (rev 74989)
@@ -448,25 +448,17 @@
                                LineTag end;
                                LineTag tag;
 
-                               start = document.selection_start.tag;
-                               end = document.selection_end.tag;
-                               color = 
((SolidBrush)document.selection_start.tag.color).Color;
+                               start = document.selection_start.line.FindTag 
(document.selection_start.pos);
+                               end = document.selection_start.line.FindTag 
(document.selection_end.pos);
+                               color = start.color.Color;
 
                                tag = start;
-                               while (true) {
-                                       if 
(!color.Equals(((SolidBrush)tag.color).Color)) {
+                               while (tag != null && tag != end) {
+
+                                       if (!color.Equals (tag.color.Color))
                                                return Color.Empty;
-                                       }
 
-                                       if (tag == end) {
-                                               break;
-                                       }
-
-                                       tag = document.NextTag(tag);
-
-                                       if (tag == null) {
-                                               break;
-                                       }
+                                       tag = document.NextTag (tag);
                                }
 
                                return color;
@@ -502,27 +494,18 @@
                                LineTag end;
                                LineTag tag;
 
-                               start = document.selection_start.tag;
-                               end = document.selection_end.tag;
-                               font = document.selection_start.tag.font;
+                               start = document.selection_start.line.FindTag 
(document.selection_start.pos);
+                               end = document.selection_start.line.FindTag 
(document.selection_end.pos);
+                               font = start.font;
 
                                if (selection_length > 1) {
                                        tag = start;
-                                       while (true) {
+                                       while (tag != null && tag != end) {
 
-                                               if (!font.Equals(tag.font)) {
+                                               if (!font.Equals(tag.font))
                                                        return null;
-                                               }
 
-                                               if (tag == end) {
-                                                       break;
-                                               }
-
-                                               tag = document.NextTag(tag);
-
-                                               if (tag == null) {
-                                                       break;
-                                               }
+                                               tag = document.NextTag (tag);
                                        }
                                }
 

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

Reply via email to