opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix: support non-Latin keyboard layouts (e.g., Korean IME) for keybindings

Open devxoul opened this issue 3 weeks ago • 2 comments

Summary

  • Fix keybindings not working when using non-Latin keyboard layouts (e.g., Korean, Japanese, Chinese IME)

Problem

When Kitty keyboard protocol is enabled, pressing Ctrl+C with Korean IME active sends:

  • \x1b[12618::99;5u (codepoint=12618 which is 'ㅊ', baseCode=99 which is 'c')

The keybind system was only checking name ('ㅊ') and ignoring baseCode ('c'), causing keybindings to fail.

Solution

Use baseCode (base layout codepoint) when available in keybind matching. This correctly identifies the physical key regardless of the active keyboard layout.

Changes

  1. keybind.ts: Use baseCode when available for key name resolution
  2. app.tsx: Add baseCode check in ErrorComponent (renders outside KeybindProvider, so needs explicit handling)

Future Improvement

After opentui#426 is released, upgrading the @opentui/core dependency will provide this fix at the parser level, making the app.tsx change unnecessary.

Related: https://github.com/sst/opentui/commit/4a8442193e972c7649a195fad5578b511916e5c9

devxoul avatar Dec 22 '25 13:12 devxoul

That PR is merged, I'll release and upgrade opentui later.

kommander avatar Dec 22 '25 15:12 kommander

@kommander Hi, I saw opentui 0.1.63 got released and we're now using it since 7f5e30834f6c541a5abce2f6e7160f2b79c407b7. Maybe we can merge this PR?

devxoul avatar Dec 29 '25 06:12 devxoul