Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Negative index validation in TextBoxRegEx #2293

Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static void ValidateTextBox(TextBox textbox, bool force = true)
{
if (validationModel == ValidationMode.Dynamic)
{
int selectionStart = textbox.SelectionStart - 1;
int selectionStart = textbox.SelectionStart == 0 ? textbox.SelectionStart : textbox.SelectionStart - 1;
textbox.Text = textbox.Text.Remove(selectionStart, 1);
textbox.SelectionStart = selectionStart;
}
Expand Down