fix(tui): resolve keyboard shortcuts failing with non-English IME#21177
Open
MinseongS wants to merge 1 commit intoanomalyco:devfrom
Open
fix(tui): resolve keyboard shortcuts failing with non-English IME#21177MinseongS wants to merge 1 commit intoanomalyco:devfrom
MinseongS wants to merge 1 commit intoanomalyco:devfrom
Conversation
b316c38 to
07a6d64
Compare
When Korean IME is active, Ctrl+C registers as Ctrl+ㅊ because the terminal sends the IME-composed character instead of the physical key. Add IME-to-QWERTY mapping table as fallback when Kitty protocol's baseCode is unavailable. Other layouts (Russian, Japanese, etc.) can be added to the same map. Closes anomalyco#21163
07a6d64 to
9082cf9
Compare
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.
Issue for this PR
Closes #21163
Type of change
What does this PR do?
With Korean IME on, all keyboard shortcuts break. Ctrl+C becomes Ctrl+ㅊ, Ctrl+X becomes Ctrl+ㅌ, and so on. I dug into this by adding debug logging to the key event handler and got:
name="ㅊ" ctrl=true baseCode=undefined raw="\x1b[12618;5u" source=kittySo the terminal sends the Korean character instead of "c", and
evt.name === "c"never matches. I also checked if Kitty protocol'sbaseCodecould give us the physical key, but most terminals (VSCode, macOS Terminal) just don't send it.My fix adds
resolveKeyName()in keybind.ts that:baseCodeif the terminal sends it (future-proof)I also updated the hardcoded
evt.name === "c"checks in 6 TUI components to go throughresolveKeyName().The mapping table is easy to extend — other layouts just need their entries appended to the same map.
How did you verify your code works?
Built the binary locally and tested with Korean 2-Set IME on macOS. Ctrl+C exits, Ctrl+X opens leader key, normal Korean typing works fine, English shortcuts unchanged. Type check passes.
Screenshots / recordings
N/A — keyboard input change, no visual difference
Checklist