Add ime_state: live IME composition state for safe CJK entry#434
Merged
Conversation
Typing into a CJK field while the IME is composing corrupts entry — the candidate text isn't committed, so reads return half-formed glyphs and the next keystroke edits the composition. text_unicode is blind to this. Expose the focused window's live composition/conversion state (Windows IMM32, read-only) behind an injectable reader, with is_composing and a wait_for_composition_commit gate, so flows wait for commit first.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 37 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
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
Sixth feature of the ROUND-15 cross-app OS lane. Typing into a CJK/JP/KR field while the IME is composing corrupts entry — the candidate text isn't committed, so reads return half-formed glyphs and the next keystroke edits the composition.
text_unicode(VK_PACKET) is blind to this.utils/ime_state/:ime_state(focused window's{open, composing, composition, conversion, conversion_flags}via Windows IMM32, read-only, injectablereader),is_composing(boolean gate),wait_for_composition_commit(block until commit; injectableclock/sleep/reader),decode_conversion_mode(pureIME_CMODE_*bitmask decoder).ImmGetContext/ImmGetOpenStatus/ImmGetConversionStatus/ImmGetCompositionStringWread-only; all decode/wait logic runs through the seam, fully testable without an IME.__all__;AC_ime_state/AC_is_composing/AC_wait_for_composition_commit/AC_decode_conversion_modeexecutor commands; matching read-onlyac_*MCP tools; Script Builder under Shell.v208_features_doc.rst+WHATS_NEW.md.Test
test/unit_test/headless/test_ime_state_batch.py— pure decode, state via injected reader (composing/idle/missing-keys),is_composing, wait-for-commit (returns + timeout) with injected reader+clock+sleep, plus facade + executor/MCP/builder wiring. All 12 green;ruff+banditclean; package stays Qt-free.