-
-
Notifications
You must be signed in to change notification settings - Fork 49
Fire event when invalid reference pasted. Prevent input of too long v… #1207
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
Conversation
…erse/chapter values
| // chapter and verse is optional in regex, make it 1 if not given | ||
| if (string.IsNullOrEmpty(chapter)) | ||
| chapter ="1"; | ||
| else if (chapter.Length > 3 && Regex.IsMatch(chapter, @"^\d+$")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that the actual resulting behavior here would not be what a user would expect. I think maybe if the chapter or verse portion is longer than 3 digits, we would just want to treat it like any other invalid pasted reference. It's most likely a typo or something and any one of the extra digits could be the errant one.
| // chapter and verse is optional in regex, make it 1 if not given | ||
| if (string.IsNullOrEmpty(chapter)) | ||
| chapter ="1"; | ||
| else if (chapter.Length > 3 && Regex.IsMatch(chapter, @"^\d+$")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the Regex.IsMatch then. If it's longer than 3 characters, it's invalid no matter what.
| /// <summary>Fired when any part of the reference is invalid</summary> | ||
| public event EventHandler InvalidReferenceEntered; | ||
| /// <summary>Fired when any part of the pasted reference is invalid</summary> | ||
| public event EventHandler InvalidReferencePasted; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a new public event, it should have an entry in the ### Added section of CHANGELOG.md (and it should have +semver:minor in the comment)
tombogle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment about adding entry to CHANGELOG
…erse/chapter values
This change is