Repository navigation
Fix TextBox IME replacement range crash - #14786
Conversation
Clamp NSTextInputClient replacement ranges to the current UTF-16 storage bounds before handing them to NSTextView.insertText/setMarkedText, and normalize a missing marked-text selection to the end of the marked text. A stale IME range past the end raised NSRangeException (Sentry CMUXTERM-MACOS-VD0). Co-authored-by: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 17 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
All contributors have signed the CLA ✍️ ✅ |
|
Merge receipt for |
6319fbe PR catch-up: run automatically when main goes green (manaflow-ai#14790) 8e4e505 iOS: replace a silent control stream instead of closing a live connection (manaflow-ai#14695) c4b36fd Code session snapshots on a main-sized stack to fix deep split SIGBUS (manaflow-ai#14787) 5a69850 ci: fetch compiled products from another owned mini over the LAN first (manaflow-ai#14779) d3d8941 ci: record warm-state distance per owned admission, fit a cost model, route admission by it (manaflow-ai#14778) ea5a166 Fix main-thread deadlock in session autosave via ghostty_surface_needs_confirm_quit (manaflow-ai#14784) 049eb4e Fix TextBox IME replacement range crash (manaflow-ai#14786) afd8ec0 Bound process-tree recursion depth in cmux top payloads (manaflow-ai#14785) 7cf0c92 iOS: release closed browser stream panels and display links (manaflow-ai#14782) # Conflicts: # .github/workflows/ci-artifact-transport.yml # .github/workflows/ci-guards.yml # .github/workflows/ci-macos.yml # .github/workflows/pr-catch-up.yml
Ported from upstream manaflow-ai#14786 (049eb4e): "Fix TextBox IME replacement range crash (manaflow-ai#14786)".
Revives #5346 (closed as stale in the 09-23 bulk close)
What / why
TextBoxInputTextViewstill forwards the IME's rawreplacementRangetoNSTextView.insertText/setMarkedText. When an IME hands back a stale range past the end of the UTF-16 storage (seen with Japanese input at the end of the text), AppKit raisesNSRangeException(Sentry CMUXTERM-MACOS-VD0). This clamps the replacement range to the storage bounds, and normalizes anNSNotFoundmarked-text selection to the end of the marked text.Changes vs the original
insertTextoverride (which now also tracks nesteddidChangeText). The sanitized range is also whatqueueAutomaticAttachmentFileCleanupsees.cmuxTests/TextBoxMentionCompletionTests.swift.Testing
TextBoxMentionCompletionTests).🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes a crash in
TextBoxInputTextView(Sentry CMUXTERM-MACOS-VD0) where an IME can return a stalereplacementRangepast the end of the UTF-16 text storage, raisingNSRangeExceptionin AppKit.insertTextandsetMarkedTextnow clamp the range to the storage bounds, and anNSNotFoundmarked-text selection is normalized to the end of the marked text.cmuxTests/TextBoxMentionCompletionTests.swiftfor the UTF-16-end clamp and the selection normalization.Written for commit 7a4c430. Summary will update on new commits.