Fix dropped and duplicated IME composition commits - #6060
Open
AmethystLiang wants to merge 1 commit into
Open
Conversation
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.
Summary
insertText, and legacykeypressobservations for a pending IME commitRoot cause
compositionendcurrently defers reading the helper textarea until the browser propagates the committed value. During that window, IBus/Chromium can also expose the logical commit throughbeforeinput/inputandkeypress, and a following key or Enter can force finalization after the textarea has already been cleared. The existing boolean pending state can therefore be cancelled before the correct value is read, or the same commit can be emitted once from the input route and again from the deferred finalizer.Fast two-set Hangul adds one boundary case: a composition can end, the Latin key for a transferred final consonant can arrive, and the next preedit can begin without a separate
insertTextcommit for that key. The pending state now records that next-composition boundary so the key remains owned by the new preedit.The reconciliation is limited to the existing pending-composition window. It adds no platform-wide suppression and no new timing delay.
Tests
npm ciandnpm run setupnpm run test-unit -- --forbid-only(2422 passing)NODE_OPTIONS=--max-old-space-size=8192 npm run lintnpm run lint-apiRegression coverage includes propagated and unpropagated exactly-once commits, a cleared commit before a following key or Enter, Hangul/ASCII/Hangul ordering, consecutive Hangul syllables, final-consonant transfer (
텟to테plus스), duplicate input routes, repeated identical legitimate commits, and generic multi-character IME commits.The Linux X11 IBus investigation that located the corruption at xterm.js
onDatais documented in stablyai/orca#9862. Native Japanese and Chinese IME validation was not performed.