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

Feat: MaxLength Validation #144

Merged
merged 1 commit into from
Dec 3, 2023

Conversation

Vaibhav2002
Copy link
Contributor

Fixes #143

@Vaibhav2002
Copy link
Contributor Author

Vaibhav2002 commented Nov 18, 2023

Hey @MohamedRejeb , there is this one issue which I couldn't understand how to fix
For example, I've set maxLength to 15, now after I have typed 15 or 14 characters, if I toggle Unordered/Ordered List, the app crashes with this kind of exception

java.lang.StringIndexOutOfBoundsException: begin 2, end 16, length 13
    at java.lang.String.checkBoundsBeginEnd(String.java:3942)
    at java.lang.String.substring(String.java:2467)
    at com.mohamedrejeb.richeditor.utils.AnnotatedStringExtKt.append-RcvT-LA(AnnotatedStringExt.kt:83)
    at com.mohamedrejeb.richeditor.utils.AnnotatedStringExtKt.append-RcvT-LA(AnnotatedStringExt.kt:24)
    at com.mohamedrejeb.richeditor.model.RichTextState.updateAnnotatedString(RichTextState.kt:622)
    at com.mohamedrejeb.richeditor.model.RichTextState.updateTextFieldValue(RichTextState.kt:574)
    at com.mohamedrejeb.richeditor.model.RichTextState.updateParagraphType(RichTextState.kt:458)
    at com.mohamedrejeb.richeditor.model.RichTextState.addUnorderedList(RichTextState.kt:393)
    at com.mohamedrejeb.richeditor.model.RichTextState.toggleUnorderedList(RichTextState.kt:383)

Any idea, how to fix this?

@MohamedRejeb
Copy link
Owner

I'll merge it and fix the error.

@MohamedRejeb MohamedRejeb merged commit 57834c1 into MohamedRejeb:main Dec 3, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support limiting characters in TextField
2 participants