Skip to content

Fix dropped committed IME text in the terminal surface - #493

Merged
coneilen merged 1 commit into
scgopi:mainfrom
coneilen:coneilen-microsoft-state-aware-menu-enablement
Sep 27, 2026
Merged

coneilen merged 1 commit into
scgopi:mainfrom
coneilen:coneilen-microsoft-state-aware-menu-enablement

Conversation

@coneilen

Copy link
Copy Markdown
Collaborator

Fixes a real Windows terminal input defect found while gathering IME parity evidence.

The defect

Pinned Winghostty consumes WM_IME_COMPOSITION and returns 0, so the message never reaches DefWindowProc and no WM_CHAR fallback is generated. Committed IME result text therefore has exactly one delivery path: on_ime_update(..., committed=1). Production TerminalSurface.onImeUpdate discarded every argument, so committed CJK text never reached the terminal.

The callback also did not match the pinned ABI: it declared the final parameter cursor: u32 where win32_host.h declares uint8_t committed. Registration goes through @ptrCast, which erased the mismatch at compile time.

The fix

onImeUpdate now matches the ABI (committed: u8), ignores preedit (committed == 0), and enqueues committed UTF-8 to the owning surface through the existing bounded terminal input queue used by ordinary text.

Evidence

A focused test drives the real production callback and proves preedit queues nothing while committed Japanese text reaches the correct surface queue. Native dispatch tests create a real Unicode EDIT control and observe the IME message sequence at its window procedure, then exercise the production TranslateMessage/DispatchMessageW path under US-International and French layouts with physical scan codes, observing a real dead-key WM_DEADCHAR followed by an accented character. Unavailable layouts are logged and skipped rather than silently weakened.

The accelerator table remains 18 entries with all positional assertions unchanged. The test runner is unchanged and still derives 50 distinct roots; no -limm32 addition was required.

Ledger row 185 stays Partial: these are hidden-window Win32 runtime tests, not a foreground UIA walkthrough or live IME candidate-window validation, and terminal preedit rendering remains provider-owned.

RED: pinned zig test src\TerminalSurface.zig --test-filter "committed IME composition enters the terminal input queue" -> expected 1, found 0; 0 passed; 0 skipped; 1 failed.
GREEN: pinned zig test src\TerminalSurface.zig --test-filter "committed IME composition enters the terminal input queue" -> All 1 tests passed.
REGRESSION: pinned full MainWindow, TerminalSurface, and App zig test roots -> All 47, 64, and 649 tests passed respectively.

Route committed Winghostty IME results into the terminal input queue and add native dispatch coverage for EDIT composition, dead keys, and non-US layouts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen merged commit fafa52c into scgopi:main Sep 27, 2026
10 of 11 checks passed
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