Skip to content

Match key bindings by base layout key on non-Latin layouts - #1016

Merged
HalFrgrd merged 3 commits into
HalFrgrd:masterfrom
okhsunrog:kitty-base-layout-key
Sep 27, 2026
Merged

HalFrgrd merged 3 commits into
HalFrgrd:masterfrom
okhsunrog:kitty-base-layout-key

Conversation

@okhsunrog

Copy link
Copy Markdown
Contributor

With the kitty keyboard protocol enabled, ctrl+в on a Cyrillic layout arrives as ctrl+в rather than ctrl+d, so none of the default ctrl bindings fire, while plain readline gets the legacy ^D byte and works. Terminals that support REPORT_ALTERNATE_KEYS also send the base layout key (the key at the same position in the US layout); this uses it as a fallback. Fixes #1000.

  • When no binding matches a key pressed with Ctrl/Alt/Super/Meta/Hyper, retry with the base layout key. Bindings on the layout character keep precedence, and plain or shifted typing is never remapped.
  • Accept single non-ASCII characters in key bind / key remap: the length check counted bytes, so Cyrillic letters were rejected
  • Tests for the fallback and non-ASCII key parsing

Depends on HalFrgrd/termina#1 (KeyEvent::base_layout_code). Cargo.toml currently points at my termina fork; I'll switch it to the merged rev once that lands.

With the kitty keyboard protocol, ctrl+в on a Cyrillic layout arrives as
ctrl+в rather than ctrl+d, so no binding matched. When nothing matches a
key pressed with a command modifier, retry with the base layout key the
terminal reports (the key at the same position in the US layout).

Also parse single non-ASCII characters in bindings and remaps: the check
counted bytes, so Cyrillic letters were rejected.

Uses termina's new KeyEvent::base_layout_code.

Fixes HalFrgrd#1000
@HalFrgrd

Copy link
Copy Markdown
Owner

Looks good, thank you!

@HalFrgrd
HalFrgrd merged commit d101b05 into HalFrgrd:master Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keybinds work only on the english layout

2 participants