Author: jackson
Date: 2006-09-25 16:59:34 -0400 (Mon, 25 Sep 2006)
New Revision: 65893
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 getting a tag at the location there can
* be
multiple tags at the same spot, these are 0-lengthed tags that
appear when extra formatting has been stuck in a location. We
need to pull out the last of these 0 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-25 20:29:35 UTC (rev 65892)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-09-25 20:59:34 UTC (rev 65893)
@@ -1,5 +1,12 @@
2006-09-25 Jackson Harper <[EMAIL PROTECTED]>
+ * TextControl.cs: When getting a tag at the location there can be
+ multiple tags at the same spot, these are 0-lengthed tags that
+ appear when extra formatting has been stuck in a location. We
+ need to pull out the last of these 0 lengthed tags.
+
+2006-09-25 Jackson Harper <[EMAIL PROTECTED]>
+
* TextControl.cs: Fix print out in debug method.
* TextBoxBase.cs: When text is set bail if we are setting to the
previous value.
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-25 20:29:35 UTC (rev 65892)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
2006-09-25 20:59:34 UTC (rev 65893)
@@ -354,7 +354,7 @@
while (tag != null) {
if (((tag.start - 1) <= pos) && (pos <
(tag.start + tag.length - 1))) {
- return tag;
+ return LineTag.GetFinalTag (tag);
}
tag = tag.next;
}
@@ -3346,7 +3346,7 @@
while (tag != null) {
if (index < (start + tag.start
+ tag.length)) {
line_out = line;
- tag_out = tag;
+ tag_out =
LineTag.GetFinalTag (tag);
pos = index - start;
return;
}
@@ -3357,12 +3357,12 @@
if (next_line != null) {
line_out =
next_line;
- tag_out =
next_line.tags;
+ tag_out =
LineTag.GetFinalTag (next_line.tags);
pos = 0;
return;
} else {
line_out = line;
- tag_out = tag;
+ tag_out =
LineTag.GetFinalTag (tag);
pos =
line_out.text.Length;
return;
}
@@ -3559,11 +3559,11 @@
for (int pos = tag.start; pos < end;
pos++) {
if (x < line.widths[pos]) {
index = pos;
- return tag;
+ return
LineTag.GetFinalTag (tag);
}
}
index=end;
- return tag;
+ return LineTag.GetFinalTag (tag);
}
if (tag.next != null) {
tag = tag.next;
@@ -3574,7 +3574,7 @@
}
index = line.text.Length;
- return tag;
+ return LineTag.GetFinalTag (tag);
}
}
}
@@ -4417,12 +4417,13 @@
// Beginning of line is a bit special
if (pos == 0) {
+ // Not sure if we should get the final tag here
return tag;
}
while (tag != null) {
if ((tag.start <= pos) && (pos <
(tag.start+tag.length))) {
- return tag;
+ return GetFinalTag (tag);
}
tag = tag.next;
@@ -4431,6 +4432,17 @@
return null;
}
+ // There can be multiple tags at the same position, we want to
make
+ // sure we are using the very last tag at the given position
+ internal static LineTag GetFinalTag (LineTag tag)
+ {
+ LineTag res = tag;
+
+ while (res.next != null && res.next.length == 0)
+ res = res.next;
+ return res;
+ }
+
/// <summary>Combines 'this' tag with 'other' tag</summary>
internal bool Combine(LineTag other) {
if (!this.Equals(other)) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches