Expand description
Core types for the planned 0.1.0 trait surface (per SPEC.md).
These are introduced alongside the legacy sqeel-vim public API. The
trait extraction (phase 5) progressively rewires the existing FSM and
Editor to operate on Selection / SelectionSet / Edit / Pos.
Until that work lands, the legacy types in [crate::editor] and
[crate::vim] remain authoritative.
Structs§
- Attrs
- Buffer
Id - Opaque buffer identifier owned by the host. Engine echoes it back
in
Host::Intentvariants for buffer-list operations (SwitchBuffer, etc.). Generation is the host’s responsibility. - Color
- Content
Edit - Engine-native representation of a single buffer mutation in the
shape tree-sitter’s
InputEditconsumes. Emitted bycrate::Editor::mutate_editand drained by hosts viacrate::Editor::take_content_editsso the syntax layer can fan edits into a retained tree without the engine taking a tree-sitter dependency. - Default
Host - Default no-op
Hostimplementation. Suitable for tests, headless embedding, or any host that doesn’t yet need clipboard / cursor-shape / cancellation plumbing. - Edit
- A pending or applied edit. Multi-cursor edits fan out to
Vec<Edit>ordered in reverse byte offset so each entry’s positions remain valid after the prior entry applies. - Editor
Snapshot - Coarse editor snapshot suitable for serde round-tripping.
- Highlight
- Modifiers
- Modifier bits accompanying every keystroke.
- Mouse
Event - Noop
Fold Provider - No-op
FoldProviderfor hosts that don’t expose folds. Every row is visible;is_row_hiddenalways returnsfalse. - Options
- Editor settings surfaced via
:set. Per SPEC. Consumed once trait extraction lands; today’s legacySettings(in [crate::editor]) continues to drive runtime behaviour. - Pos
- Grapheme-indexed position.
lineis zero-based row;colis zero-based grapheme column within that line. - Render
Frame - Engine render frame consumed by the host once per redraw.
- Selection
- A single anchored selection. Empty (caret-only) when
anchor == head. - Selection
Set - Ordered set of selections. Always non-empty in valid states;
primaryindexes the cursor visible to vim mode. - Style
- Engine-native style. Replaces direct ratatui
Styleuse in the public API once phase 5 trait extraction completes; until then both coexist. - Viewport
- Visible region of a buffer — the runtime viewport state the host owns and mutates per render frame.
Enums§
- Cursor
Shape - Cursor shape intent emitted on mode transitions. Hosts honor it via
Host::emit_cursor_shapeonce the trait extraction lands. - Engine
Error - Errors surfaced from the engine to the host. Intentionally narrow —
callsites that fail in user-facing ways return
Result<_, EngineError>; internal invariant breaks usedebug_assert!. - FoldOp
- Canonical fold-mutation op carried through
FoldProvider::apply. - Highlight
Kind - Highlight kind emitted by the engine’s render pass. The host’s style
resolver picks colors for
Selection/SearchMatch/etc.;Syntax(id)carries an opaque host-supplied id whose styling lives in the host. - Input
- Single input event handed to the engine.
- Mode
- Vim editor mode. Distinct from the legacy
crate::VimMode— that one is the host-facing status-line summary; this is the engine’s internal state machine. - Mouse
Kind - Option
Value - Typed value for
Options::set_by_name/Options::get_by_name. - Selection
Kind - What kind of region a
Selectioncovers. - Snapshot
Mode - Status-line mode summary. Bridges to the legacy
crate::VimModewithout leaking the full FSM type into the snapshot wire format. - Special
Key - Special key codes — anything that isn’t a printable character.
- Wrap
Mode - Soft-wrap mode for the renderer + scroll math +
gj/gk. Engine-native equivalent ofhjkl_buffer::Wrap; the engine converts at the boundary to the buffer’s runtime wrap setting.
Traits§
- Buffer
- Buffer super-trait — the pre-1.0 contract every backend implements.
- Buffer
Edit - Mutating sub-trait of
Buffer. Distinct trait name from the crate-rootEditstruct — this one carries methods, the other is a value type. - Cursor
- Cursor sub-trait of
Buffer. Pre-0.1.0; signature follows SPEC.md §“Buffertrait surface”. - Fold
Provider - Fold-iteration + mutation trait. The engine asks “what’s the next
visible row” / “is this row hidden” through this surface, and
dispatches fold mutations through
FoldProvider::apply, so fold storage can live wherever the host pleases (on the buffer, in a separate host-side fold tree, or absent entirely). - Host
- Host adapter consumed by the engine. Lives behind the planned
Editor<B: Buffer, H: Host>generic; today it’s the contract thatbuffr-modal::BuffrHostand the (future)sqeel-tuiHost impl align against. - Query
- Read-only query sub-trait of
Buffer. - Search
- Search sub-trait of
Buffer. The pattern is owned by the engine (see SPEC.md “Open issues”); buffers do not cache compiled regexes.