Skip to main content

dispatch_visual

Function dispatch_visual 

Source
pub fn dispatch_visual(
    handle: &KeymapHandle,
    chord: &KeyChord,
    kind: VisualKind,
    partial_chord: &[KeyChord],
    active_minor_modes: &[ModeId],
) -> Action
Expand description

Dispatch a Visual-mode key event through the keymap registry.

  1. CONTROL-bearing key -> Action::None. (Legacy short- circuited CONTROL and only CONTROL.)
  2. Mid-sequence (a text-object prefix i / a already in partial_chord): resolve [partial_chord..., chord] against the Visual catalog. This is the SAME partial-chord machinery Normal mode uses – viw is v then the two-key chord [i, w], vaf is [a, f], etc. There is NO per-object code: every text object in [crate::keymap_normal::text_object_rows] works automatically, exactly as the user asked (“we shouldn’t have to do any custom handling of any text objects”).
  3. Fresh keystroke. Blockwise overlay: Char('I') / Char('A') go to EnterBlockVisualInsert / EnterBlockVisualAppend before lookup. Charwise / linewise fall through.
  4. Single-chord lookup. Bound -> Invoke (folding any wildcard capture); Partial -> AbsorbPartialChord (a bare i / a starts a text object – absorb it so the next key resolves the pair); Unbound -> Action::None.

partial_chord is the host’s running multi-key prefix (the same Editor::partial_chord the Normal path threads); it is empty on a fresh chord and holds the absorbed [i] / [a] mid-text-object.