Skip to main content

Module editor

Module editor 

Source
Expand description

The editor state: modes, pending keys, named registers, buffers. One input path for TUI and headless — both call feed.

Mode handlers live beside this file: normal, visual, insert.

Re-exports§

pub use collections::CollectionRow;
pub use collections::CollectionRowInfo;
pub use remote::RemoteEvent;
pub use remote::RemoteView;
pub use resolution::ResolutionEvent;
pub use resolution::ResolutionState;

Modules§

block
Visual rectangles share streamed cell geometry with rendering. Partial wide clusters become spaces; complete tabs retain their bytes in the register.
collections
Source-backed editable collections. Journal edits publish immediately; generated chrome is protected and source undo groups commit at action boundaries.
events
The unified event source (0018 §services): every async producer — terminal, LSP, git, shell, picker, clipboard — lands on ONE channel as a typed AppEvent. The main loop parks on it; workers wake the loop the instant they post. Gone: the 500ms poll latency between a job finishing and the UI noticing.
io
File I/O is owned work. Only matching completions may publish into a view.
keys
Streaming script-token decoding shared by Editor::feed_text and headless. Unknown tokens stay literal, and a lone ‘<’ never fabricates a closing ‘>’.
macros
Macros (0016 §macros): q{reg} records raw key events, @{reg} replays them — replay feeds keys back through the ONE input machine, so a macro is exactly as capable as hands on the keyboard. Counts work (3@a), @@ repeats the last replay.
pending
One owner for modal input (R7). A text prompt — :ex, /search, ?search, |pipe — owns its LineEdit plus everything about the moment it opened: the pane (full selections and viewport), the document and its revision. Structural operator composition stays in the Walker; prompts never fabricate grammar text.
remote
Editor-side remote workspace ownership. Transport actors live in strop-remote; this module owns view intent, periodic reads, explicit connections and browsing.
resolution
Bounded input work: large grammar reads run on one CPU owner. Input after an accepted command stays ordered; Ctrl-C revokes it. Preview and execution use the same revision/cursor/command-stamped pure resolver result.
trace
Editor-specific producers and the forensic replay driver. Storage and ordering belong to strop-trace.
transact
A mutation lease is the publication boundary, independent of undo grouping.
view
Viewport motions and the jump-back cluster (the vim canon wave): Ctrl-d/u/f/b scroll, zz/zt/zb + H/M/L viewport placement, ZZ write-quit, Ctrl-^ alternate buffer, gv/gi re-entry, g;/g, the change list. Viewport geometry comes from scroll_to_cursor, which the render loop feeds every frame — the pane’s view_rows is the editor’s single source of truth for “how tall is the screen”.

Structs§

AttachRecord
The serializable outcome of one attach attempt. Refusals carry server: None; a spawned (or replayed) server keeps its identity.
BlameGutter
Per-buffer blame gutter state (0011 §3), keyed by canonical path — no parallel vector to keep aligned, and index churn can never pair one buffer with another’s blame. Valid only while the buffer’s revision and line count still match the capture.
BlockRect
The ctrl-v rectangle (0017): line span by buffer index, cell span by LineLayout columns — named fields, not a naked mixed-unit tuple.
ClipboardKey
The document that asked for a clipboard read (R9): the terminal result owns this ticket — a paste lands only in the buffer that requested it, and failures surface instead of collapsing into “empty clipboard”.
CommitFiles
The commit a Diff surface’s file belongs to, with the commit’s full changed-file list — the sidebar’s data (typed numstat rows, the same ones the changed-files surface renders from; 0011 §4). repo is the provenance the whole delta chain replays: ]f steps and dives from this surface run against that repository — remote surfaces never answer from the local cwd (0036 RW8).
ContainerKey
Document
One document: the text buffer plus everything that used to live in parallel vectors keyed by buffer index (0014 wave 2). One struct, one arena — the alignment invariant is the type system now.
DocumentDiagnostics
Editor
FindPending
A pending f/F/t/T awaiting its target char — the leap-style candidate overlay’s input. Named fields, not a naked (u8, bool).
LastSearch
The compiled query owns matching semantics for repeat, preview and highlighting.
LspServer
Pane
One pane: the document it shows plus its own view state.
PendingPermalink
Frozen pure data for a permalink whose SSH host alias is still unresolved: the alias’s answer plus these fields rebuild the URL with no repository handle, no IO, and no state that moved meanwhile. The captured repository determines which machine and working directory own the OpenSSH configuration (0036 RW8).
PickerGlue
PreparedDiff
PreparedFiles
PreviewKey
One supervised preview read: the picker instance it serves and the native path being read.
RankingEvent
Register
One register cell: text + shape (vim’s unnamed register is ").
RemoteCompletionKey
The typed moment a request owns; every delivery re-checks it.
RemoteDirectory
RemoteDocument
ShellIntent
Sidebar
The immutable commit tree; native filenames stay in its owning file list.
WorkspaceRegistry

Enums§

ContainerResult
One job’s terminal answer.
DiffRow
One canonical row projection shared by rendering and source navigation.
DocumentSource
What backs a document. Derived facts (readonly, save refusal) come from this, not from fields callers must keep in sync.
GitJob
Results from git workers; the event loop (or headless drain) routes each to its handler. Every variant owns its ticket — there is no unowned error path (R9).
InputOwner
Who consumes the next key. Priority is fixed by input_owner’s evaluation order: pending fields, pickers, transient cards, document. A late hover/blame reply never steals a modal field’s input or paint.
Key
LayoutDir
v1 is a flat layout: Row = vertical splits side by side, Column = horizontal splits stacked.
Mode
PreviewSource
RemoteCompletionResult
The worker’s terminal answer. Failures travel as Outcome::Failed; this carries only successes.
ReviewRow
ShellKey
Which surface owns a shell request, captured at registration and never re-derived from current editor state at delivery.
SidebarRow
One sidebar row in tree form (zed-lite: always-expanded, directory rows dim and shallow, files indented by depth).
Surface

Constants§

FLASH_FOR

Functions§

git_channel
The git job channel ends (created once in Editor::new).
state_json
The headless state directive’s logical observation (0006): mode, cursor, pending input, picker and register state — no cells. The binary’s headless driver prints it; the forensic observation embeds it.

Type Aliases§

ClipboardResult
The owned terminal clipboard-read result.
FrameDraw
The injected frame renderer’s shape (0046): editor, columns, rows, record-action flag — the binary’s implementation renders via TestBackend.
PreviewResult
The terminal result of a preview request.
Previews
ShellResult
The owned terminal shell result: one per registered request.