Skip to main content

dispatch_input

Function dispatch_input 

Source
pub fn dispatch_input<H: Host>(
    editor: &mut Editor<View, H>,
    input: Input,
) -> bool
Expand description

Drive the vim FSM with one hjkl_engine::Input.

This is the sole entry-point that decouples callers from the engine’s internal FSM. Returns true if the engine consumed the keystroke.

§Phase 6.6c / 6.6d / 6.6e

Search-prompt mode (6.6c) is intercepted here before begin_step because it is a true short-circuit (no prelude/epilogue needed).

Insert mode (6.6d) is hosted in hjkl-vim::insert::step_insert.

Normal / Visual / VisualLine / VisualBlock / operator-pending modes (6.6e) are hosted in hjkl-vim::normal::step_normal. Both are wrapped with begin_step / end_step so macro recording, viewport scrolling, and current_mode sync all fire correctly.

In debug builds this is also where the curswant invariant is checked — see [crate::curswant]. Every keystroke that reaches the vim FSM passes through here, from the app (hjkl_vim_tui::handle_key), the compat-oracle driver, :normal, and macro replay alike, which makes it the one place the check has to live.