Fix/myanmar visual order ime trailing newline - #2763
Open
quochuynh67 wants to merge 2 commits into
Open
Conversation
…etDiff) getDiff() used cursorPosition to limit how much of the common prefix/suffix it would trim. When an IME reports a cursor/composing position past the end of the text (observed with the Myanmar "Visual order" keyboard on Windows), that limit stranded the document's implicit trailing newline inside the computed deleted/inserted fragments, causing the diff to try to delete and reinsert it. Applying that diff could crash the editor with `targetChild should not be null`. Add a cheap fallback pass that trims any remaining common suffix/prefix between the deleted and inserted fragments after the cursor-limited scan, so genuinely unchanged trailing/leading characters are never included in the diff. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHxHHtPJWVvjPK26rnS2Xe
Correct the earlier test/CHANGELOG wording to match the actual crash evidence: the document was fully wiped (docPlainTextAfter became empty) and the editor threw `targetChild should not be null` because getDiff deleted and reinserted the document's own trailing newline, not merely a "cursor past the end" edge case. Add a regression test using the exact oldText/newText/cursorPosition captured from a real session with the Burmese "Myanmar Visual order" keyboard. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHxHHtPJWVvjPK26rnS2Xe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Describe what this PR does. If modifying behavior, explain the current and new behavior, along with the motivation.
Related Issues
Type of Change