Skip to content

Fix/myanmar visual order ime trailing newline - #2763

Open
quochuynh67 wants to merge 2 commits into
singerdmx:masterfrom
quochuynh67:fix/myanmar-visual-order-ime-trailing-newline
Open

Fix/myanmar visual order ime trailing newline#2763
quochuynh67 wants to merge 2 commits into
singerdmx:masterfrom
quochuynh67:fix/myanmar-visual-order-ime-trailing-newline

Conversation

@quochuynh67

Copy link
Copy Markdown

Description

Describe what this PR does. If modifying behavior, explain the current and new behavior, along with the motivation.

Related Issues

Type of Change

  • Feature: New functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Refactor: Code reorganization, no behavior change.
  • Breaking: Alters existing functionality and requires updates.
  • 🧪 Tests: New or modified tests
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Build/configuration changes.

quoc.huynh and others added 2 commits August 29, 2026 17:33
…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
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