Fix Kitty base-layout key reporting - #741
Open
Frozen wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Kitty keyboard protocol defines the base-layout alternate as the key at the same physical position in the standard PC-101 layout. iTerm2 currently computes it by stripping modifiers and translating the key through the active layout. On a Russian layout, the physical C key therefore produces Cyrillic
сfor both the primary and base values, and the encoder omits the base alternate entirely:CSI 1089;5uCSI 1089::99;5uThis derives the base-layout value from the macOS virtual key code using the fixed ANSI/PC-101 positions instead of the active input source. Functional and keypad keys keep their existing handling. ISO/JIS-only keys, which have no PC-101 position, do not report a base alternate.
The mapping covers every ANSI letter, digit, punctuation key, and Space, with a negative test for the ISO Section key.
Specification: https://sw.kovidgoyal.net/kitty/keyboard-protocol/#key-codes
Kitty’s macOS implementation uses the same fixed virtual-key-code approach: https://github.com/kovidgoyal/kitty/blob/master/glfw/cocoa_window.m
Tested with:
tools/run_tests.expect ModernTests/ModernKeyMapperTests