Key input dispatch infrastructure.
The active shell supplies two ordered handler lists:
Overlay handlers — modal UI overlays (picker, completion, conflict prompt) that take priority over everything and run before the active surface.
Surface handlers — scope-specific dispatch (Scoped), global bindings (Ctrl+S, Ctrl+Q), and the mode FSM (vim normal/insert/ visual). These live inside the active surface and are called after overlays pass through.
Summary
Types
Source that contributed registry entries.
Input handler dispatched by the active shell.
Input handler ordering metadata.
Input handler paired with its authoritative contribution source.
Functions
Returns the appropriate bottom-of-stack dispatch handler for the
active editing model. Each model owns its own handler module via the
Minga.Editing.Model.dispatch_handler/0 callback; adding a new model
requires no changes here.
Returns true when the editing model is mid-sequence and should receive the next key before any handler-specific dispatch runs.
Keyboard modifier flag for Alt/Option.
Keyboard modifier flag for Ctrl.
Returns interactive transient handlers in precedence order above the active surface.
Registers an input handler for the surface stack.
Resets the surface handler registry to built-ins only.
Returns surface handlers paired with their authoritative contribution sources.
Returns the editor-level handlers for buffer editing.
Returns the surface handlers for the given editor state.
Removes every input handler contributed by a source.
Types
@type contribution_source() :: :builtin | :config | {:extension, atom()}
Source that contributed registry entries.
@type dispatch_handler() :: module() | sourced_handler()
Input handler dispatched by the active shell.
@type handler_entry() :: {module(), contribution_source(), handler_meta()}
Input handler ordering metadata.
@type sourced_handler() :: {module(), contribution_source()}
Input handler paired with its authoritative contribution source.
Functions
Returns the appropriate bottom-of-stack dispatch handler for the
active editing model. Each model owns its own handler module via the
Minga.Editing.Model.dispatch_handler/0 callback; adding a new model
requires no changes here.
@spec key_sequence_pending?(MingaEditor.State.t()) :: boolean()
Returns true when the editing model is mid-sequence and should receive the next key before any handler-specific dispatch runs.
For vim: leader key sequences, pending g prefix, operator-pending
mode, and command-line mode. For CUA: always false (no multi-key
sequences). Used by AgentPanel and FileTreeHandler to decide whether
to delegate directly to the bottom-of-stack dispatch handler.
@spec mod_alt() :: non_neg_integer()
Keyboard modifier flag for Alt/Option.
@spec mod_ctrl() :: non_neg_integer()
Keyboard modifier flag for Ctrl.
@spec overlay_handlers() :: [module()]
Returns interactive transient handlers in precedence order above the active surface.
Exclusive modals and completion run first, followed by which-key, focused hover, signature help, and finally operation cancellation. If none consumes the key, the Editor delegates to the active surface.
@spec register_handler(contribution_source(), module(), keyword()) :: :ok
Registers an input handler for the surface stack.
@spec reset_handlers() :: :ok
Resets the surface handler registry to built-ins only.
@spec surface_handler_entries(map()) :: [sourced_handler()]
Returns surface handlers paired with their authoritative contribution sources.
@spec surface_handlers() :: [module()]
Returns the editor-level handlers for buffer editing.
These handle scope-specific dispatch, global bindings, and the
editing model's key handler. The last handler in the list is
determined by the active editing model: ModeFSM for vim,
CUA.Dispatch for CUA.
Returns the surface handlers for the given editor state.
The editing model is read from state.editing_model to determine
whether the bottom-of-stack handler is ModeFSM (vim) or CUA.Dispatch.
@spec unregister_source(contribution_source()) :: :ok
Removes every input handler contributed by a source.