Skip to main content

dispatch_replace

Function dispatch_replace 

Source
pub fn dispatch_replace(handle: &KeymapHandle, chord: &KeyChord) -> Action
Expand description

Dispatch a key event through the keymap registry.

Matches today’s translate_replace semantics:

  1. <C-…> -> Action::None. (The legacy match table short-circuited CONTROL and only CONTROL; <M-Esc> still exits to Normal because the legacy match ran on event.code alone after the CONTROL guard.)
  2. Strip the remaining modifiers (ALT / SHIFT / SUPER) before the lookup so <M-Esc> matches the bare-<Esc> literal and <M-x> falls through the bare-char wildcard. For bare-char chords this is a no-op: KeyChord::from_event already strips redundant SHIFT (case encodes it). For specials like <Esc> it is the legacy “match by KeyCode alone” semantics expressed in trie terms.
  3. Bound -> the bound action, with the wildcard Action::OverwriteChar('\0') placeholder substituted by the captured char.
  4. Unbound / Partial -> Action::None. Replace mode has no multi-key chords today; Partial would only arise if a user-config / plugin pushes a layer with multi-key bindings.