Skip to content

fix(android): correct insertion boundary in FormattingStore and add serializer bounds check#279

Merged
hryhoriiK97 merged 1 commit intomainfrom
fix/android-formatting-store-boundary-and-serializer-bounds
Apr 29, 2026
Merged

fix(android): correct insertion boundary in FormattingStore and add serializer bounds check#279
hryhoriiK97 merged 1 commit intomainfrom
fix/android-formatting-store-boundary-and-serializer-bounds

Conversation

@hryhoriiK97
Copy link
Copy Markdown
Collaborator

@hryhoriiK97 hryhoriiK97 commented Apr 29, 2026

What/Why?

Change adjustForEdit to shift ranges when editLocation == range.start (using >= instead of >), matching iOS behavior. Without this, typing at the start of a formatted range fails to shift it, causing the inserted character to incorrectly inherit the style.

Add bounds clamping in MarkdownSerializer to prevent StringIndexOutOfBoundsException if the formatting store ever contains ranges that exceed the text length.

Testing

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes

…erializer bounds check

Change adjustForEdit to shift ranges when editLocation == range.start
(using >= instead of >), matching iOS behavior. Without this, typing
at the start of a formatted range fails to shift it, causing the
inserted character to incorrectly inherit the style.

Add bounds clamping in MarkdownSerializer to prevent
StringIndexOutOfBoundsException if the formatting store ever contains
ranges that exceed the text length.

Made-with: Cursor
@hryhoriiK97 hryhoriiK97 changed the title fix(android): correct insertion boundary in FormattingStore and add s… fix(android): correct insertion boundary in FormattingStore and add serializer bounds check Apr 29, 2026
@hryhoriiK97 hryhoriiK97 merged commit 431bc84 into main Apr 29, 2026
5 checks passed
@hryhoriiK97 hryhoriiK97 deleted the fix/android-formatting-store-boundary-and-serializer-bounds branch May 1, 2026 17:38
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.

1 participant