Skip to main content

Module state

Module state 

Source
Expand description

Small App-helper state types – pure data, no renderer coupling.

Phase 5.2: extracted from lattice-ui-tui::app so the eventual App migration carries fewer in-line type definitions. Each struct here is a piece of state App holds in a field (search line in progress, last search, unnamed register, prev-pane snapshot). Renderer-agnostic by construction.

Structs§

CompletionState
Cmdline completion popup state: candidates and selection. Renderer-agnostic; the renderer reads this via &App.
InFlightLiveQuery
Spawned on_query_changed future / stream paired with the query it was launched against. The drain compares launched_for_query against the picker’s live query; if they differ, the user has kept typing and a newer fire is already in flight (or coming via debounce) – discard the stale result.
LastFind
Capture of the most recent find/till for ; / , repeat.
LastSearch
Last completed search – consulted by n and N. VM.3d-2: defined in lattice-grammar now that n is a motion; re-exported so no call site moved. VM.3d-2: the last completed / / ? / * / # search, which is all n and N need to repeat it. Moved here from the host (which re-exports the name, so no call site moved) for the reason LastFind was: n is a motion now, and the state it repeats has to reach the grammar.
LastVisual
Most-recently-completed visual selection. Used by gv to reselect.
LivePickerQueryState
Live-picker query state. Installed when open_picker resolves a source whose spec().live is true; survives until the picker is dismissed.
MacroRecording
In-progress macro recording. q<reg> starts; q again stops and persists into the register table.
MinibufferFocus
MB.1 / MB.5a (rich minibuffer): the editing state suspended while a minibuffer prompt (: command line or /·? search line) owns self.document. When a prompt opens, [Editor::focus_editing_buffer] swaps self.document / document_buffer_id / active_buffer to the synthetic *command-line* / *search-line* buffer and stashes the prior editing focus here without touching the pane tree (the active pane keeps rendering its own buffer). [Editor::restore_editing_buffer] pops it back on submit / cancel. Some(_) is the “a prompt is focused” flag; whether it’s the command line vs the search line is decided by Editor::search_line (command_line_active / search_line_active). Prompt-agnostic by design so git-commit-line / repl-input reuse it unchanged (design §6).
MissingArgPrompt
5.5.G.23.cmdline: result of resolving a missing required first arg on :-submit. Built by Editor::try_resolve_missing_arg_prompt and consumed by do_command_line_submit.
OptionCache
Hot-path option cache. Mirrors the typed-options registry’s resolved values for the active buffer; reads on this struct fire on every render tick, so the cache exists to skip a HashMap lookup per option. Repopulated by App::rebuild_option_cache after every :set.
PendingBlockInsert
In-flight blockwise-visual insert (I or A).
PendingPickerAccept
In-flight async picker accept. The future from PickerSourceGenerator::accept_async is spawned on the LSP runtime (a plugin source’s accept is an async guest call bound to its actor task, so it must not block the actor thread); its resolved outcome lands here via rx and is applied by drain_pending_picker_accept. target is the open-target override consumed at accept time and re-applied when the outcome commits. Mirrors PendingPickerInit; the cancel token drops a superseded accept (a rapid second accept before this one drains).
PendingPickerInit
In-flight async picker init. The future from PickerSourceGenerator::init is spawned on the LSP runtime; its resolved batch lands here via rx. The cancel token lets a subsequent :picker <source> drop the predecessor before it completes.
PendingTransientBuild
TR.2: in-flight async transient build. A guest-backed menu’s builder answers a TransientBuildFuture rather than a spec; it is spawned on the LSP runtime and its resolved spec lands here via rx, seated by drain_pending_transient_build on the async-landed wake.
PositionEntry
One entry in the unified position history (DESIGN.md §5.1.1).
PrevPaneState
Snapshot of the active pane’s state captured just before help took it over. Used by dismiss_popup to restore the user to the buffer + cursor + scroll they came from. The same struct serves both display modes (in-pane and popup-overlay).
ReplaceEntry
One replace-mode entry – the byte that was at at before the overwrite, so <BS> can restore it. original = None means the overwrite extended the line (the position was past EOL); <BS> deletes the inserted char rather than restoring a byte.
RingEntry
YR.2: a ring slot — the register plus how it got here.
SearchLine
In-progress / or ? search state (MB.5a). The pattern text is NOT stored here — it lives in the focused *search-line* buffer (single source of truth, read via Editor::search_pattern), the same way the : line reads *command-line*. This struct is the “search is active” marker + the metadata the buffer can’t carry: the direction (/ vs ?) and the origin cursor preserved so <Esc> restores it and incremental preview anchors its search.
SnippetCandidateMeta
Sidecar metadata for snippet candidates in the active insert-completion popup. Indexed by the candidate’s CandidateData::Extension { payload } (u32 LE) – same shape as the LSP source’s sidecar. The host renders the snippet body on accept and starts an ActiveSnippet; this struct carries the parsed body plus the display fields the popup row uses.
SubstitutePreview
Snapshot of an in-progress :s/pat/repl/... preview. Refreshed on every cmdline keystroke while the input parses as a substitute; consumed by the renderer to overlay match ranges (and the typed replacement, when present) on the target buffer.
TagStackEntry
One entry on the vim-style tag stack. Pushed by gd (and the goto-* family) at the pre-jump cursor; popped by <C-t> to walk back. Distinct from the jump list because the user’s mental model for <C-t> is “undo the drill-down chain”, not “step through every cursor jump in chronological order”.
UnnamedRegister
The unnamed register’s payload. v1 uses a single global slot; the full vim register zoo ("a-z, "+, "*, etc.) lands later.
YankRing
A bounded history of everything that has been yanked or deleted.

Enums§

PositionSource

Constants§

LIVE_PICKER_DEBOUNCE
Debounce window before a live picker’s query change fires on_query_changed. Telescope uses ~150ms; chosen so that burst keystrokes coalesce into one source call without feeling laggy. Constant lives here (not in lattice-picker) because debounce is host policy – the picker primitive is renderer- and timer-agnostic.