Skip to main content

from_keystroke

Function from_keystroke 

Source
pub fn from_keystroke(
    key: &str,
    control: bool,
    alt: bool,
    shift: bool,
    platform: bool,
) -> Option<KeyChord>
Expand description

Normalise a GPUI Keystroke-shaped input into a canonical KeyChord.

key is GPUI’s Keystroke::key string id (lowercase by convention, but matched case-insensitively for robustness). control / alt / shift / platform are the four modifier bits of Keystroke::modifiers; platform maps to KeyMods::SUPER so it joins the same modifier bitfield the rest of the host uses.

Returns None for inputs with no chord representation: empty key string, multi-character key strings that aren’t recognised special names, or "f"-prefixed function keys outside the 1..=24 range.