2008-12-11 Carlos Alberto Cortez <calberto.cortez@gmail.com>
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Thu, 11 Dec 2008 11:37:57 +0000 (11:37 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Thu, 11 Dec 2008 11:37:57 +0000 (11:37 -0000)
* MaskedTextBox.cs: MaskedTextService.Replace doesn't expect the
length of the text, but the end position, so we need to substract 1 to
have a valid value. Also, in the same InputText method, don't use
SelectionLength as the length of the text, since the selected text
could actually be empty, but we need to set the value anyway.
Fixes #457370.

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

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

index 574a67a38d377b6ea384e677b95c9ddb8eb86cdb..4bdcc963dd79f86bb061c513cad03415e8115542 100644 (file)
@@ -1,3 +1,12 @@
+2008-12-11  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * MaskedTextBox.cs: MaskedTextService.Replace doesn't expect the
+       length of the text, but the end position, so we need to substract 1 to
+       have a valid value. Also, in the same InputText method, don't use
+       SelectionLength as the length of the text, since the selected text
+       could actually be empty, but we need to set the value anyway.
+       Fixes #457370.
+
 2008-12-10  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * TextBox.cs: Don't do any auto complete task if the custom source is
index 9c2f7e63754cc72f37794deabd33f699b34a1bcf..d8cf068e70f8477629d762dc8ece7d9be8c54b74 100644 (file)
@@ -853,14 +853,14 @@ namespace System.Windows.Forms
                        
                        if (RejectInputOnFirstFailure) {
                                if (overwrite) {
-                                       provider.Replace (input, SelectionStart, SelectionStart + SelectionLength, out testPosition, out resultHint);
+                                       provider.Replace (input, SelectionStart, SelectionStart + input.Length - 1, out testPosition, out resultHint);
                                } else {
                                        provider.InsertAt (input, SelectionStart);
                                }
                        } else {
                                while (!result && input.Length > 0) {
                                        if (overwrite) {
-                                               result = provider.Replace (input, SelectionStart, SelectionStart + input.Length, out testPosition, out resultHint);
+                                               result = provider.Replace (input, SelectionStart, SelectionStart + input.Length - 1, out testPosition, out resultHint);
                                        } else {
                                                result = provider.InsertAt (input, SelectionStart, out testPosition, out resultHint);
                                        }