diff options
| author | joonhwan <joonhwan.lee@gmail.com> | 2026-07-26 02:52:45 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-25 20:52:45 +0300 |
| commit | 6cfaa079a921e8ba7d01e0fdf14f88a13845cb9a (patch) | |
| tree | c441b13730b5c7d43aa654e7b47fcb0fdd54492e /docs | |
| parent | d4e0dd3d903c50d2edb8c3cec71952a83989b310 (diff) | |
feat: switch IME to ASCII in prefix mode on Windows (Korean IME) (#1823)
* feat: switch IME to ASCII in prefix mode on Windows
Extend switch_ascii_input_source_in_prefix to Windows: detect IME state
via WM_IME_CONTROL and toggle to ASCII with SendInput for the Korean IME.
Other IME languages are detected and left unchanged.
refs #1802
* docs: clarify Windows (Korean IME) support for prefix ASCII switching
Follow-up to the Windows prefix ASCII switch, which extended
switch_ascii_input_source_in_prefix to Windows but left the surrounding
text describing macOS only.
- Settings row label: "(macOS)" -> "(macOS/Windows)", plus its test.
- Generalize the Windows behavior wording to "switches the IME to
English (ASCII) input" in the config-reference.json entry and the
model.rs doc comment, and state that Windows support is currently
limited to the Korean IME.
- Add a :::caution aside noting the Korean-IME-only limitation to the
en/ja/zh preview docs, keeping the three translations in sync.
refs #1802
* fix: warn when prefix IME toggle injection is incomplete
SendInput can queue fewer events than requested (for example when blocked
by UIPI), which would otherwise leave the IME silently stuck in ASCII or
native mode. Log a warning with the sent and expected counts so the failure
is diagnosable.
refs #1802
* fix: guard prefix IME restore and correct open-status naming
Address maintainer review on the Windows prefix ASCII switch:
- Restore only when safe: store the foreground window at switch time and,
before toggling back, require that the same window is still focused and
the IME is still in English. This stops restore from toggling another
application or overriding a manual return to Hangul during prefix mode.
- Report injection success from send_vk_tap and only arm restoration when
the initial toggle landed; on a partial injection retry the dropped
key-up so a key is not left logically held down. The injection policy is
split into send_vk_tap_with(inject) so the success, partial, and failure
branches are unit-tested without the real SendInput.
- Correct the WM_IME_CONTROL sub-command naming: 0x0005 is IMC_GETOPENSTATUS
(IME open state), not IMC_GETCONVERSIONMODE. Behavior is unchanged; the
constant, comments, and tests now describe the open-status read.
refs #1802
* fix: bound IME open-status read with a timeout
The prefix IME switch reads IMC_GETOPENSTATUS via WM_IME_CONTROL, which
crosses into the terminal-emulator process. A plain SendMessageW would block
herdr's client thread until that process responds, indefinitely if it hangs.
Read through SendMessageTimeoutW with SMTO_ABORTIFHUNG and a short timeout
instead; on timeout the switch is skipped and restore does nothing, so a hung
host process can no longer freeze prefix-mode entry or exit.
refs #1802
* fix: preserve windows ime restoration after partial injection
refs #1802
---------
Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'docs')
4 files changed, 19 insertions, 7 deletions
diff --git a/docs/next/website/src/content/docs/configuration.mdx b/docs/next/website/src/content/docs/configuration.mdx index a5591880..df6dc8d3 100644 --- a/docs/next/website/src/content/docs/configuration.mdx +++ b/docs/next/website/src/content/docs/configuration.mdx @@ -432,14 +432,18 @@ Restricting `cjk_ime_agents` avoids showing an extra hardware cursor in unrelate ## Prefix input source switching -On macOS, Herdr can temporarily switch to the system ASCII-capable input source while prefix commands and prefix-launched modes are active: +On macOS and Windows, Herdr can temporarily switch to an ASCII-capable input source while prefix commands and prefix-launched modes are active: ```toml [experimental] switch_ascii_input_source_in_prefix = true ``` -Herdr restores the previous input source when returning to terminal input or entering a text field. This setting has no effect on other platforms. +On macOS this switches to the current ASCII-capable keyboard layout; on Windows it switches the IME to English (ASCII) input. Herdr restores the previous input source when returning to terminal input or entering a text field. This setting has no effect on other platforms. + +:::caution[Windows support is Korean IME only] +On Windows, support is currently limited to the Korean IME. With an IME for any other language, this setting leaves the input source unchanged. +::: ## Environment variables diff --git a/docs/next/website/src/content/docs/ja/configuration.mdx b/docs/next/website/src/content/docs/ja/configuration.mdx index 0eba298d..e2b5ea5e 100644 --- a/docs/next/website/src/content/docs/ja/configuration.mdx +++ b/docs/next/website/src/content/docs/ja/configuration.mdx @@ -428,14 +428,18 @@ cjk_ime_agents = ["claude", "pi", "codex"] ## プレフィックス入力ソースの切り替え -macOS では、プレフィックスコマンドとプレフィックスから起動したモードがアクティブな間、Herdr がシステムの ASCII 対応入力ソースへ一時的に切り替えるようにできます: +macOS と Windows では、プレフィックスコマンドとプレフィックスから起動したモードがアクティブな間、Herdr が ASCII 対応の入力ソースへ一時的に切り替えるようにできます: ```toml [experimental] switch_ascii_input_source_in_prefix = true ``` -ターミナル入力に戻るかテキストフィールドに入ると、Herdr は以前の入力ソースを復元します。この設定は他のプラットフォームには影響しません。 +macOS ではその時点の ASCII 対応キーボードレイアウトへ切り替えます。Windows では IME を英語(ASCII)入力へ切り替えます。ターミナル入力に戻るかテキストフィールドに入ると、Herdr は以前の入力ソースを復元します。この設定は他のプラットフォームには影響しません。 + +:::caution[Windows では韓国語 IME のみ対応] +Windows でのサポートは現時点で韓国語 IME に限定されています。それ以外の言語の IME を使用している場合、この設定は入力ソースを変更しません。 +::: ## 環境変数 diff --git a/docs/next/website/src/content/docs/zh-cn/configuration.mdx b/docs/next/website/src/content/docs/zh-cn/configuration.mdx index bb04da07..8b8f6c4d 100644 --- a/docs/next/website/src/content/docs/zh-cn/configuration.mdx +++ b/docs/next/website/src/content/docs/zh-cn/configuration.mdx @@ -428,14 +428,18 @@ cjk_ime_agents = ["claude", "pi", "codex"] ## 前缀输入源切换 -在 macOS 上,当前缀命令和由前缀启动的模式处于活动状态时,Herdr 可以临时切换到系统中支持 ASCII 的输入源: +在 macOS 和 Windows 上,当前缀命令和由前缀启动的模式处于活动状态时,Herdr 可以临时切换到支持 ASCII 的输入源: ```toml [experimental] switch_ascii_input_source_in_prefix = true ``` -返回终端输入或进入文本字段时,Herdr 会恢复之前的输入源。此设置在其他平台上无效。 +在 macOS 上,会切换到当前支持 ASCII 的键盘布局;在 Windows 上,会将 IME 切换到英文(ASCII)输入。返回终端输入或进入文本字段时,Herdr 会恢复之前的输入源。此设置在其他平台上无效。 + +:::caution[Windows 上仅支持韩语 IME] +目前 Windows 上的支持仅限于韩语 IME。使用其他语言的 IME 时,此设置不会改变输入源。 +::: ## 环境变量 diff --git a/docs/next/website/src/data/config-reference.json b/docs/next/website/src/data/config-reference.json index b3841de2..4ad61f01 100644 --- a/docs/next/website/src/data/config-reference.json +++ b/docs/next/website/src/data/config-reference.json @@ -1113,7 +1113,7 @@ "key": "experimental.switch_ascii_input_source_in_prefix", "type": "boolean", "default": "false", - "description": "While prefix mode is active, temporarily switch the macOS host input source to an ASCII-capable keyboard layout so prefix commands are read as ASCII even when a CJK IME is active, then restore the previous input source when prefix mode exits. macOS only; a no-op elsewhere and a best-effort no-op if the switch fails." + "description": "While prefix mode is active, temporarily switch the host input source to an ASCII-capable mode so prefix commands are read as ASCII even when an IME is active, then restore the previous input source when prefix mode exits. On macOS this selects the ASCII-capable keyboard layout; on Windows it switches the IME to English (ASCII) input. Windows support is currently limited to the Korean IME; with an IME for any other language, the input source is left unchanged. macOS and Windows only; a no-op elsewhere and a best-effort no-op if the switch fails." } ] } |
