[PR #5956] fix: support non-Latin keyboard layouts (e.g., Korean IME) for keybindings #11667

Open
opened 2026-02-16 18:16:34 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5956

State: open
Merged: No


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

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5956 **State:** open **Merged:** No --- ## 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](https://github.com/sst/opentui/pull/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
yindo added the pull-request label 2026-02-16 18:16:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11667