Skip to content

fix(ios): prevent crash when deleting mixed selection or using IME input#277

Merged
hryhoriiK97 merged 1 commit intomainfrom
fix/ios-stale-selection-range-crash
Apr 29, 2026
Merged

fix(ios): prevent crash when deleting mixed selection or using IME input#277
hryhoriiK97 merged 1 commit intomainfrom
fix/ios-stale-selection-range-crash

Conversation

@hryhoriiK97
Copy link
Copy Markdown
Collaborator

@hryhoriiK97 hryhoriiK97 commented Apr 29, 2026

What/Why?

Fixes: #276

Always update _lastSelectedRange in textViewDidChangeSelection and textInputDidChangeSelection before the isApplyingFormatting guard, ensuring _preEditSelectedRange is never stale when handleTextChanged computes edit parameters. Also clamp modificationRange passed to the detector pipeline so out-of-bounds values cannot reach ENRMWordsUtils.

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

Always update _lastSelectedRange in textViewDidChangeSelection and
textInputDidChangeSelection before the isApplyingFormatting guard,
ensuring _preEditSelectedRange is never stale when handleTextChanged
computes edit parameters. Also clamp modificationRange passed to the
detector pipeline so out-of-bounds values cannot reach ENRMWordsUtils.

Made-with: Cursor
@hryhoriiK97 hryhoriiK97 merged commit 78b4419 into main Apr 29, 2026
5 checks passed
@hryhoriiK97 hryhoriiK97 deleted the fix/ios-stale-selection-range-crash branch April 29, 2026 09:22
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.

Crash when deleting mixed selection or using Chinese/IME keyboard

1 participant