Editing domain facade.
Cursor motions, text operations, search, bracket matching, comment toggling, formatting, and scroll state. This module is the only valid entry point from outside the domain.
External callers use this facade for behavior. Struct types
(Minga.Editing.Completion.t(), Minga.Editing.Search.Match.t(),
Minga.Editing.Scroll.t()) may be referenced directly in @spec
annotations per AGENTS.md type-crossing rules. Protocols
(Minga.Editing.Text.Readable) and behaviours
(Minga.Editing.Model) are also part of the public API.
Summary
Functions
Returns the active editing model module from global config. Prefer active_model/1 when state is available.
Returns the active editing model module from editor state.
Apply save-time transforms (trim trailing whitespace, final newline).
Backspace, removing the matching bracket when the cursor is between a pair.
Returns the keymap binding state for scope trie resolution.
Resolve comment prefix with nil fallback.
Resolve comment prefix accounting for injection ranges.
Compute comment toggle edits for the given lines (pure, no Buffer I/O).
What cursor shape should the frontend render?
Format content using a formatter command string.
Is a leader key sequence in progress?
Insert a character, auto-inserting the matching bracket when appropriate.
Is the user currently inserting text?
Is a multi-key sequence in progress (leader key, operator-pending, etc.)?
Is a macro currently being recorded? Returns {true, register} or false.
Is the editor in a minibuffer-occupying mode (command line, search, eval)?
Current editing mode atom (e.g., :normal, :insert, :visual, :cua).
Creates a new scroll state with default values.
Pin scroll to the bottom of content.
Resolve the formatter spec for a filetype and file path.
Resolve a scroll target given total content lines and visible height.
Scroll down by the given number of lines.
Scroll to the top of content.
Scroll up by the given number of lines.
Find all matches for a pattern within a line range.
Find the next match for a pattern starting from a position.
Does the user have an active selection?
Set the scroll offset directly.
Short mode label for the status bar (e.g., 'NORMAL', 'INSERT', '').
Substitute all matches in buffer content.
Substitute matches in a single line, returning styled spans for preview.
Returns the word under the cursor, or nil.
Functions
@spec active_model() :: module()
Returns the active editing model module from global config. Prefer active_model/1 when state is available.
Returns the active editing model module from editor state.
Apply save-time transforms (trim trailing whitespace, final newline).
Backspace, removing the matching bracket when the cursor is between a pair.
Returns the keymap binding state for scope trie resolution.
This is the discriminator that Scope.resolve_key/3 uses to select
which trie of bindings to look up. CUA always returns :cua. Vim
returns the current mode mapped to the scope-relevant subset
(:normal, :insert, :input_normal).
Use this instead of manually checking cua_active? and branching
on the editing model in input handlers.
Resolve comment prefix with nil fallback.
Resolve comment prefix accounting for injection ranges.
Compute comment toggle edits for the given lines (pure, no Buffer I/O).
@spec cursor_shape(map()) :: :beam | :block | :underline
What cursor shape should the frontend render?
Format content using a formatter command string.
Is a leader key sequence in progress?
Insert a character, auto-inserting the matching bracket when appropriate.
Is the user currently inserting text?
Is a multi-key sequence in progress (leader key, operator-pending, etc.)?
Is a macro currently being recorded? Returns {true, register} or false.
Is the editor in a minibuffer-occupying mode (command line, search, eval)?
Current editing mode atom (e.g., :normal, :insert, :visual, :cua).
Creates a new scroll state with default values.
Pin scroll to the bottom of content.
Resolve the formatter spec for a filetype and file path.
Resolve a scroll target given total content lines and visible height.
Scroll down by the given number of lines.
Scroll to the top of content.
Scroll up by the given number of lines.
Find all matches for a pattern within a line range.
Find the next match for a pattern starting from a position.
Does the user have an active selection?
Set the scroll offset directly.
Short mode label for the status bar (e.g., 'NORMAL', 'INSERT', '').
Substitute all matches in buffer content.
Substitute matches in a single line, returning styled spans for preview.
Returns the word under the cursor, or nil.