pub fn translate_key_down(event: &KeyDownEvent) -> Option<KeyEvent>Expand description
Translates a GPUI [KeyDownEvent] into a platform-agnostic twrite KeyEvent.
This is the single boundary where GPUI key strings are interpreted;
everything downstream matches on KeyCode. Arrow keys arrive under
different names per platform/backend (left vs arrowleft) and converge
on one variant here.
Printable characters come from [Keystroke::key_char] — the character
that would actually be typed ("A" with Shift held, layout-aware) —
rather than [Keystroke::key], which only names the physical key ("a").
Using key would make capitals, shifted symbols, and non-US layouts
untypeable. key_char is honored only for genuine text input: command
combos (Ctrl/Cmd held) keep physical key names so Ctrl+B-style bindings
keep matching, and Option/Alt-modified keys keep theirs too.
NOTE (gpui 0.2.2): the git-era KeyDownEvent::prefer_character_input
signal (AltGr, macOS Option accents) does not exist in the 0.2.2 API, so
Alt-modified keys always keep physical names here. Revisit when upgrading
past 0.2.2 if that signal returns.