Skip to content

Add ime_state: live IME composition state for safe CJK entry#434

Merged
JE-Chen merged 1 commit into
devfrom
feat/ime-state-batch
Jun 25, 2026
Merged

Add ime_state: live IME composition state for safe CJK entry#434
JE-Chen merged 1 commit into
devfrom
feat/ime-state-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 25, 2026

Copy link
Copy Markdown
Member

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.

  • Headless core utils/ime_state/: ime_state (focused window's {open, composing, composition, conversion, conversion_flags} via Windows IMM32, read-only, injectable reader), is_composing (boolean gate), wait_for_composition_commit (block until commit; injectable clock/sleep/reader), decode_conversion_mode (pure IME_CMODE_* bitmask decoder).
  • Default reader uses ImmGetContext/ImmGetOpenStatus/ImmGetConversionStatus/ImmGetCompositionStringW read-only; all decode/wait logic runs through the seam, fully testable without an IME.
  • 5 layers wired: facade __all__; AC_ime_state/AC_is_composing/AC_wait_for_composition_commit/AC_decode_conversion_mode executor commands; matching read-only ac_* MCP tools; Script Builder under Shell.
  • Docs: EN + Zh 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 + bandit clean; package stays Qt-free.

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.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 37 complexity · 0 duplication

Metric Results
Complexity 37
Duplication 0

View in Codacy

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.

@JE-Chen JE-Chen merged commit 2dd1b96 into dev Jun 25, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/ime-state-batch branch June 25, 2026 21:17
@sonarqubecloud

Copy link
Copy Markdown

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