Skip to content

Fix dropped and duplicated IME composition commits - #6060

Open
AmethystLiang wants to merge 1 commit into
xtermjs:masterfrom
AmethystLiang:fix/ibus-hangul-composition-commits
Open

Fix dropped and duplicated IME composition commits#6060
AmethystLiang wants to merge 1 commit into
xtermjs:masterfrom
AmethystLiang:fix/ibus-hangul-composition-commits

Conversation

@AmethystLiang

Copy link
Copy Markdown

Summary

  • reconcile the deferred textarea value, insertText, and legacy keypress observations for a pending IME commit
  • flush a pending commit before the next key while retaining its copied textarea range and commit data
  • keep an unmatched keypress out of the previous commit when a new preedit consumes it, as happens during Hangul final-consonant transfer

Root cause

compositionend currently defers reading the helper textarea until the browser propagates the committed value. During that window, IBus/Chromium can also expose the logical commit through beforeinput/input and keypress, 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 insertText commit 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

  • clean npm ci and npm run setup
  • npm run test-unit -- --forbid-only (2422 passing)
  • focused terminal/composition unit suite (175 passing)
  • NODE_OPTIONS=--max-old-space-size=8192 npm run lint
  • npm run lint-api

Regression 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 onData is documented in stablyai/orca#9862. Native Japanese and Chinese IME validation was not performed.

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