Skip to main content

dispatch_insert

Function dispatch_insert 

Source
pub fn dispatch_insert(
    handle: &KeymapHandle,
    mode: BindingMode,
    chord: &KeyChord,
    partial_chord: &[KeyChord],
    active_minor_modes: &[ModeId],
) -> Action
Expand description

Dispatch a key event in Insert mode through the layered keymap registry. Replaces the legacy input::translate_insert plus the translate_insert_completion_popup and translate_active_snippet overlay branches at the top of input::translate.

  1. pending == AfterCtrlX: reconstruct [<C-x>, normalised(event)], look up. Bound -> the bound action; anything else -> SetPending(None) to drop the pending state and let the user retry (matches legacy).
  2. Otherwise: normalise the chord per the modifier table in this module’s docstring; look up [chord].
    • Bound -> the bound action. Wildcard captures fill the char placeholder in CompletionAcceptThenInsert.
    • Partial -> absorb into App::partial_chord, and keep absorbing while the walk stays partial (OR.7c). Insert chords are therefore any depth, as in Normal; they used to be capped at two because a CONTINUING partial fell through to Action::None, which no builtin could hit (<C-x><C-o> is depth two) and a plugin’s <C-c>ni could.
    • Unbound -> private literal_text_fallback for printable chars without CONTROL; otherwise Action::None.