Skip to content

Title: Windows: TUI keybindings only work with the English keyboard layout #55371

Closed as not planned

Description

@vervolk

Description

Description

Letter-based TUI keybindings do not work while the Russian keyboard layout is active.

For example, the default sidebar toggle sequence (Ctrl+X, then B) works with the English layout but does not work with the Russian layout when pressing the same physical keys.

Steps to reproduce

  1. Start OpenCode on Windows with the default keybindings.
  2. Switch to the English keyboard layout.
  3. Press Ctrl+X, then B. The sidebar toggles.
  4. Switch to the Russian keyboard layout.
  5. Press the same physical keys. The sidebar does not toggle.

Expected behavior

Keyboard shortcuts should work with both layouts without requiring the user to switch to English.

Actual behavior

The shortcut only works with the English keyboard layout.

Environment

  • OpenCode: 2.0.29
  • OS: Windows
  • Architecture: x64
  • Shell: PowerShell
  • Installation: npm, @opencode/cli
  • Keyboard layouts: English and Russian

Impact

Users typing in Russian must switch to English to use letter-based shortcuts, then switch back to continue typing.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Thanks for the clear report! One detail is missing before we can try to reproduce this: which terminal are you running OpenCode in? For example Windows Terminal (and its version), the classic console window (conhost), WezTerm, the VS Code integrated terminal, etc. PowerShell is the shell, but the terminal is what matters here.

    OpenCode v2 can fall back to the physical key for non-Latin layouts, but only if the terminal reports the base-layout key (through the Kitty keyboard protocol). So whether this works depends on the terminal. If you can, please also say whether other shortcuts that use a letter key (for example Ctrl+C) work while the Russian layout is active.

    You can reply here with the details or edit the issue. If you edit it, please also leave a short comment saying you've updated it, so we know you're done.

    These related issues may help. The list is ordered by likelihood, most likely first:

  2. ahsan-python commented on Oct 14, 2026

    @ahsan-python

    can i help ### Root Cause Analysis

    This issue occurs because the TUI keybinding handler is likely evaluating input events based on decoded character streams (runes / localized string values) rather than physical Virtual Key Codes (VK codes) or scancodes.

    When switched to the Russian layout, pressing the physical B key emits its Cyrillic equivalent (e.g., и). Because the secondary sequence listener specifically expects the ASCII character b (byte 98) rather than the physical key mapping, the keybinding fails to trigger.

    The initial modifier step (Ctrl+X) works because standard control modifier sequences bypass character mapping and directly pass the control code, but the subsequent raw letter input is affected by the active layout.


    Suggested Fix & Implementation Strategy

    Depending on the underlying event handling layer used by the CLI/TUI:

    1. Physical Key/VK Code Binding (Recommended for Windows):
      Instead of listening for string/character values, bind shortcuts to physical key events or low-level Virtual Key Codes (e.g., VK_B on Windows). This ensures keybindings remain layout-agnostic and respond strictly to the physical key position.

    2. Cyrillic-to-QWERTY Mapping Fallback:
      If switching to VK code listening requires breaking architectural changes, implement a layout normalization fallback layer in the keybinding interceptor that maps Cyrillic characters back to their QWERTY physical equivalents when evaluating shortcut triggers:

      // Example fallback mapping for QWERTY <-> Russian layout
      const RU_TO_EN_MAP: Record<string, string> = {
        'и': 'b',
        'ч': 'x',
        // ... other key mappings
      };
      
      function normalizeKey(inputKey: string): string {
        return RU_TO_EN_MAP[inputKey.toLowerCase()] || inputKey;
      }
  3. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    We're closing this issue for now because we haven't heard back about which terminal you run OpenCode in (Windows Terminal and its version, conhost, WezTerm, VS Code, etc.).

    We need that to reproduce the problem. OpenCode v2 can only match shortcuts by physical key on a Russian layout if the terminal reports the base-layout key, so without knowing the terminal we can't tell an OpenCode bug from a terminal limitation.

    If this still happens on the latest v2, please reopen this issue or open a new one with your terminal and its version, and say whether other letter shortcuts (e.g. Ctrl+C) work with the Russian layout. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions