Skip to content

fix: post Eisu/Kana keys by default; TIS only for Affinity-class apps#117

Merged
kazukinakai merged 1 commit into
mainfrom
fix/kana-switch-google-ime
Jul 3, 2026
Merged

fix: post Eisu/Kana keys by default; TIS only for Affinity-class apps#117
kazukinakai merged 1 commit into
mainfrom
fix/kana-switch-google-ime

Conversation

@kazukinakai

Copy link
Copy Markdown
Member

Problem (v2.4.7/2.4.8 regression)

v2.4.7 switched all apps to TISSelectInputSource. That broke single-mode IMEs — Google Japanese Input (and ATOK): the menu bar showed Hiragana (あ) but typing stayed in direct/Roman input.

Root cause (verified on-device): Google IME exposes only one input mode to TIS —

com.google.inputmethod.Japanese.base   type=KeyboardInputMode  modeID=com.apple.inputmethod.Japanese

It toggles Hiragana ⇔ direct internally via the かな/英数 keys. TISSelectInputSource(base) selects the IME (updates the menu-bar icon) but cannot drive that internal mode. Kotoeri works because it exposes separate mode sources; Google/ATOK do not.

So the two requirements are mutually exclusive per-app: Affinity needs TIS (a posted key leaks as a space), Google needs the posted key (TIS can't change its mode).

Fix

  • Default: post the Eisu(102)/Kana(104) virtual keys — drives the IME's internal mode correctly for every standard app (Google/ATOK/Kotoeri). This is the original, proven mechanism.
  • TIS fallback: only for InputSourceSwitcher.tisSwitchAppBundleIDs (Affinity family), where the posted key would leak. Tracked as isTISSwitchApp on frontmost-app activation.

Tests

  • KeyEventTests: Kana/Eisu output passes through for a normal app (isTISSwitchApp=false) and is swallowed for a TIS-switch app (=true), on both keyDown and keyUp — this is exactly the behavior the prior tests failed to assert.
  • InputSourceSwitcherTests: keycode predicate + Affinity in the app set + palette-avoidance regression (kept from 2.4.8).
  • InputSourceDumpTests: skippable on-device diagnostic (CMDIME_DUMP_INPUT_SOURCES=1) that enumerates installed IMEs' TIS structure — how the root cause was found.

swift build clean · 38 tests (1 skipped, 0 failures) · swiftlint 0 serious.

Version 2.4.9 (auto-release on merge).

…apps

v2.4.7 switched all apps to TISSelectInputSource. That broke single-mode
IMEs (Google Japanese Input, ATOK): they expose one "base" input mode to
TIS and toggle Hiragana/direct internally, so TIS moved the menu-bar
indicator to Hiragana while typing stayed in direct/Roman input.

Restore posting the Eisu(102)/Kana(104) virtual keys as the default — those
drive the IME's internal mode correctly for every standard app. Keep the TIS
switch only for a small set of apps (Affinity) whose text engine mishandles
the synthesized key and leaks it as a literal space.

Verified on-device: Google IME exposes com.google.inputmethod.Japanese.base
(single KeyboardInputMode) — confirming TIS cannot drive its Hiragana mode.
Added a skippable InputSourceDumpTests diagnostic to enumerate the real TIS
structure of installed IMEs.
@kazukinakai kazukinakai enabled auto-merge July 3, 2026 13:21
@kazukinakai kazukinakai merged commit c5a0209 into main Jul 3, 2026
2 checks passed
@kazukinakai kazukinakai deleted the fix/kana-switch-google-ime branch July 3, 2026 13:22
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