Skip to content

Cyrillic Ctrl shortcuts are not recognized by Crossterm consumers despite base-layout reporting #16

Closed

Description

@ei-grad

Environment

  • Shitty 2026.07.23 when the behavior was originally observed
  • Linux with a Russian XKB layout
  • Codex CLI 0.145.0 as the affected terminal application
  • No terminal multiplexer

Observed behavior

With the Russian layout active, Shitty reports the physical Ctrl+C and Ctrl+D keys as Kitty CSI-u events containing both the active-layout character and the base-layout character:

  • physical Ctrl+C: ESC[1089::99;5:1u
  • physical Ctrl+D: ESC[1074::100;5:1u

The corresponding application receives Ctrl+с and Ctrl+в and does not recognize its ASCII Ctrl+c and Ctrl+d shortcuts. With Kitty keyboard enhancement disabled in the application, the shortcuts work through legacy keyboard encoding.

Protocol context

In the two packets above:

  • 1089 and 1074 are the active Russian-layout characters с and в;
  • 99 and 100 are the base-layout characters c and d;
  • modifier value 5 represents Ctrl;
  • event type 1 represents a key press.

The Kitty keyboard protocol defines the unicode-key-code::base-layout-key form and explicitly gives Cyrillic Ctrl+C as a base-layout reporting use case:

https://sw.kovidgoyal.net/kitty/keyboard-protocol/#key-codes

Downstream parsing

Codex 0.145.0 pins Crossterm revision 87db8bfa6dc99427fd3b071681b07fc31c6ce995. That parser reads the primary codepoint but does not retain the third base-layout component, producing Ctrl+с and Ctrl+в from the packets above.

The missing Crossterm support is tracked at:

crossterm-rs/crossterm#968

The resulting Codex behavior is tracked at:

openai/codex#35599

This issue records the terminal-side packets and the interoperability path so the behavior can be checked against future changes in Shitty and its consumers.

Activity

  1. ei-grad commented on Jul 29, 2026

    @ei-grad
    ContributorAuthor

    Current master status after the native plt refactor:

    • platform_wayland.cpp still uses xkb_state_key_get_utf32() as layoutCodepoint. With Ctrl active, xkbcommon applies the control transformation, so C/D become codepoints 3/4; baseCodepoint remains 99/100.
    • vterm.cpp still chooses layoutCodepoint as the Kitty primary key and reports the base-layout key as the alternate field.

    The same backend path was reproduced locally with an us,ru keymap:

    • Ctrl+C: ESC[3::99;5:1u
    • Ctrl+D: ESC[4::100;5:1u

    These packets occur in both layouts, so current master introduces a terminal-side failure before the existing Crossterm base-layout limitation described in this issue. The earlier Cyrillic packets (1089::99 / 1074::100) were protocol-correct; the current C0 primary values are not key identities.

    A local regression check separated the two layers:

    • current-layout level-0 identity: EN 99/100, RU 1089/1074;
    • base layout: always 99/100;
    • a compatibility path limited to Kitty alternate-key reporting + Ctrl + printable ASCII base keys passed real Codex CLI 0.145.0 PTY smoke tests for Ctrl+C and Ctrl+D in both EN and RU.

    The current frontend tests use identical layout/base values, so they do not exercise either failure.


    Prepared with LM assistance — Codex CLI

  2. ei-grad commented on Jul 29, 2026

    @ei-grad
    ContributorAuthor

    In my local build, I fixed this with a terminal-side workaround so Ctrl+C and Ctrl+D work in Codex regardless of the active keyboard layout. I made two changes.

    1. Key identity and text input in the Wayland/XKB backend

    I previously used xkb_state_key_get_utf32() as the current-layout key. Under Ctrl, xkbcommon transforms the result into a control character:

    • Ctrl+C → 3
    • Ctrl+D → 4

    I now derive the key identity separately:

    • I read the active-layout key from the active XKB layout at level 0;
    • I read the base-layout key from layout 0 at level 0;
    • I use xkb_state_key_get_utf32() only for text input.

    This gives me:

    Physical key EN layout RU layout Base layout
    C 99 1089 (с) 99
    D 100 1074 (в) 100

    2. Crossterm compatibility path

    After fixing the backend, a protocol-correct Russian-layout Ctrl+C packet looks like this:

    ESC[1089::99;5:1u
    

    Crossterm ignores the third field (99), so Codex receives Ctrl+с instead of Ctrl+c.

    To keep these shortcuts usable, I use the printable ASCII base-layout key as the Kitty primary codepoint when:

    • the application enabled Kitty alternate-key reporting;
    • Ctrl is active;
    • the base-layout key is printable ASCII.

    Ctrl+C and Ctrl+D then produce:

    ESC[99;5:1u
    ESC[100;5:1u
    

    I leave other modifiers, non-ASCII base keys, ordinary text input, and Kitty sessions without alternate-key reporting unchanged.


    Prepared with LM assistance — Codex CLI

  3. added a commit that references this issue on Aug 4, 2026
  4. pg83 commented on Aug 4, 2026

    @pg83
    Owner

    Я запилил generic ремапы для клавиатуры, локально это твою боль фиксит, тикет закрываю

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions