2007-10-15 Jonathan Pobst <monkey@jpobst.com>
authorJonathan Pobst <monkey@jpobst.com>
Mon, 15 Oct 2007 20:52:10 +0000 (20:52 -0000)
committerJonathan Pobst <monkey@jpobst.com>
Mon, 15 Oct 2007 20:52:10 +0000 (20:52 -0000)
* LineTag.cs: Fix a case where the GetCharIndex would not return 0
when the mouse was to the left of the first character in the line.

svn path=/trunk/mcs/; revision=87533

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs

index e34e3a4347dc2eb650b0fd9ee276e982d751e0dd..efe7abdd54ee32e048226df929a58f6ad3a2ee07 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-15  Jonathan Pobst  <monkey@jpobst.com>
+
+       * LineTag.cs: Fix a case where the GetCharIndex would not return 0
+       when the mouse was to the left of the first character in the line.
+
 2007-10-15  Jonathan Pobst  <monkey@jpobst.com>
 
        * TextBox.cs, TextBoxBase.cs: When setting the document's password
index da1945cc0756e154375b656d611033a441594e9e..bb7ca796811def721644000bd51fa0f1b5be6b71 100644 (file)
@@ -353,6 +353,9 @@ namespace System.Windows.Forms
                        if (Length == 0)\r
                                return start;\r
                                \r
+                       if (x < line.widths[low])\r
+                               return low - 1;\r
+                               \r
                        if (x > line.widths[line.TextLengthWithoutEnding ()])\r
                                return line.TextWithoutEnding ().Length;\r
                                \r