toBaseLayoutSpec method
Converts this KeyEvent to a specification string projected onto the base (standard US PC-101) layout key, substituting Kitty's alternate-key "base layout key" field for the character that was actually typed.
This lets an app match key bindings by physical key position rather
than by the character a non-US layout produces: Ctrl+Я on a Cyrillic
layout, reported with a base layout key of 'z', projects to
'ctrl+z'. The same shift-folding rule as toSpec applies to the
substituted character, so Ctrl+Shift+Я (base 'z') projects to
'ctrl+Z'.
Returns null for named keys and for any event where the terminal did not report a base layout key.
Implementation
String? toBaseLayoutSpec() {
if (code.kind != KeyCodeKind.char || code.baseLayoutKey == 0) return null;
final baseCode = KeyCode.char(String.fromCharCode(code.baseLayoutKey));
return _buildSpec(baseCode, modifiers, charIsProduced: false);
}