pub struct Editor {Show 69 fields
pub docs: Arena<DocumentKind, Document>,
pub io: IoState,
pub tape: Rc<Tape>,
pub git_view: WorkerId,
pub git_discovery: Load<ContextKey>,
pub hunk_load: Load<HunkKey>,
pub hunks_untracked: bool,
pub log_requests: HashMap<DocumentId, Ticket<LogKey>>,
pub card_request: Option<Ticket<CardKey>>,
pub dive_requests: HashMap<DocumentId, Ticket<DiveKey>>,
pub git_mutations: VecDeque<GitMutation>,
pub git_mutation: Option<Ticket<MutationKey>>,
pub jumplist_past: Vec<(DocumentId, usize)>,
pub jumplist_future: Vec<(DocumentId, usize)>,
pub mode: Mode,
pub pending: PendingInput,
pub walker: Walker,
pub undo_browser: Option<UndoBrowser>,
pub last_find: Option<(char, bool, bool)>,
pub last_search: Option<LastSearch>,
pub registers: HashMap<char, Register>,
pub marks: HashMap<char, (DocumentId, usize)>,
pub flash: Option<(Range, Tick)>,
pub message: String,
pub should_quit: bool,
pub ctrl_c_armed: bool,
pub last_visual: Option<(usize, usize)>,
pub last_insert_pos: Option<usize>,
pub change_idx: Option<(usize, usize)>,
pub view_rows: usize,
pub recording: Option<char>,
pub app_tx: Option<EventSender>,
pub macros: HashMap<char, Vec<Key>>,
pub last_macro: Option<char>,
pub macro_depth: usize,
pub picker: Option<PickerGlue>,
pub resolution: ResolutionState,
pub cwd: PathBuf,
pub workspaces: WorkspaceRegistry,
pub mru: Vec<DocumentId>,
pub previews: Previews,
pub git: Option<GitContext>,
pub preview_tx: Sender<PreviewResult>,
pub preview_rx: Option<Receiver<PreviewResult>>,
pub hunks: HunkSet,
pub staged_hunks: HunkSet,
pub blame_card: Option<BlameCard>,
pub blame_gutters: HashMap<DocumentId, BlameGutter>,
pub generation: u64,
pub git_tx: Sender<GitJob>,
pub git_rx: Option<Receiver<GitJob>>,
pub osc52: Option<String>,
pub terminal_output: Vec<String>,
pub needs_repaint: bool,
pub clip_tx: Sender<ClipboardResult>,
pub clip_rx: Option<Receiver<ClipboardResult>>,
pub clip_paste_pending: Option<(bool, Ticket<ClipboardKey>)>,
pub lsp_servers: Vec<LspServer>,
pub diags: HashMap<DocumentId, DocumentDiagnostics>,
pub hover_card: Option<String>,
pub shell_tx: Sender<ShellResult>,
pub shell_rx: Option<Receiver<ShellResult>>,
pub panes: Vec<Pane>,
pub active_pane: usize,
pub layout: LayoutDir,
pub config: Config,
pub state_dir: Option<PathBuf>,
pub session_policy: SessionPolicy,
pub frame_draw: Option<FrameDraw>,
/* private fields */
}Fields§
§docs: Arena<DocumentKind, Document>§io: IoState§tape: Rc<Tape>§git_view: WorkerId§git_discovery: Load<ContextKey>§hunk_load: Load<HunkKey>§hunks_untracked: bool§log_requests: HashMap<DocumentId, Ticket<LogKey>>§card_request: Option<Ticket<CardKey>>§dive_requests: HashMap<DocumentId, Ticket<DiveKey>>§git_mutations: VecDeque<GitMutation>§git_mutation: Option<Ticket<MutationKey>>§jumplist_past: Vec<(DocumentId, usize)>vim’s jumplist (ctrl-o/ctrl-i): past/future stacks of (document, byte offset) (jumps.rs).
jumplist_future: Vec<(DocumentId, usize)>§mode: Mode§pending: PendingInput§walker: WalkerThe input walker (0008 stage 2): typed parser state for counts/registers/operators/prefixes — pending stays for the free-text lines only.
undo_browser: Option<UndoBrowser>Space u browser state (editor/undo.rs); None when closed.
last_find: Option<(char, bool, bool)>Last f/F/t/T find: (char, backward, till). ; and , replay it.
last_search: Option<LastSearch>Armed by //?/*/# searches. n/N replay it; the render
highlights matches persistently (rootle: current match underlined).
registers: HashMap<char, Register>§marks: HashMap<char, (DocumentId, usize)>Marks: char → (document, byte offset). m{a} sets, '{a} jumps.
flash: Option<(Range, Tick)>§message: String§should_quit: bool§ctrl_c_armed: boolctrl-c is armed after the first warn (0015 quit policy).
last_visual: Option<(usize, usize)>Last visual range for gv (recorded per visual-mode key).
last_insert_pos: Option<usize>Where the last insert session was for gi.
change_idx: Option<(usize, usize)>g;/g, walk: (index, history depth it was taken at) — a new commit invalidates the walk.
view_rows: usizeText area height in rows — the render loop feeds it via scroll_to_cursor; viewport motions read it.
recording: Option<char>Macro recording (0016): the register being recorded into.
app_tx: Option<EventSender>The app event channel (0018): set by connect_events; late LSP attaches forward through it.
macros: HashMap<char, Vec<Key>>Recorded macros: register → key events.
last_macro: Option<char>The last replayed macro register (@@).
macro_depth: usizeMacro self-replay depth guard.
picker: Option<PickerGlue>§resolution: ResolutionState§cwd: PathBuf§workspaces: WorkspaceRegistryBound workspace contexts (0042 slice 2): one per filesystem in use.
mru: Vec<DocumentId>MRU document order (most recent first); drives Space b.
previews: PreviewsPicker preview file cache.
git: Option<GitContext>Git working surface state (M2).
preview_tx: Sender<PreviewResult>Preview file reads run on worker threads (0001 §3); results and the in-flight set are drained in drain_picker.
preview_rx: Option<Receiver<PreviewResult>>§hunks: HunkSet§staged_hunks: HunkSetHEAD↔index — the staged set (0014 wave 4); rendered in the gutter’s committed-adjacent color.
blame_card: Option<BlameCard>Git memory (M3): per-buffer surface kinds, blame card, job channel, OSC52 clipboard payload drained by the TUI.
blame_gutters: HashMap<DocumentId, BlameGutter>Each full/range/tail document owns its own revision-checked gutter.
generation: u64Bumped on every buffer-list mutation; git jobs carry the generation they were spawned under so results for dead surfaces are dropped (0011 §2).
git_tx: Sender<GitJob>§git_rx: Option<Receiver<GitJob>>§osc52: Option<String>§terminal_output: Vec<String>§needs_repaint: boolctrl-l: the terminal desynced from the model — the draw loop answers with a full repaint (vim’s redraw).
clip_tx: Sender<ClipboardResult>System-clipboard reads (paste from +) run on a worker thread;
clip_paste_pending remembers before/after AND the initiating
document until the read lands (0023 §4).
clip_rx: Option<Receiver<ClipboardResult>>§clip_paste_pending: Option<(bool, Ticket<ClipboardKey>)>§lsp_servers: Vec<LspServer>LSP server pool (0014 wave 2): one client per (workspace root, server) — a rust file and a python file in one session get their own servers. Diagnostics by path, hover card, open bookkeeping.
diags: HashMap<DocumentId, DocumentDiagnostics>§hover_card: Option<String>§shell_tx: Sender<ShellResult>Shell jobs (:!cmd output buffers, |cmd pipes): results land
in drain_shell — never a subprocess on the input path (0001 §3).
shell_rx: Option<Receiver<ShellResult>>§panes: Vec<Pane>Splits: flat row/column of panes (v1; tree layout later).
active_pane: usize§layout: LayoutDir§config: ConfigUser config (0005-lite: TOML, embedded defaults, never bricks).
state_dir: Option<PathBuf>Shared state root for explicit trust and optional session persistence.
session_policy: SessionPolicy§frame_draw: Option<FrameDraw>Injected frame renderer (0046): cell-grid production belongs to the
binary; replay of a recorded Frame action renders through this
hook. The engine never renders on its own.
Implementations§
Source§impl Editor
impl Editor
Sourcepub fn blame_gutter_for(&self, buffer: DocumentId) -> Option<&BlameGutter>
pub fn blame_gutter_for(&self, buffer: DocumentId) -> Option<&BlameGutter>
The buffer’s blame gutter, if its data is still trustworthy: same revision, same line count. Any edit since the capture voids the line↔buffer-line pairing. A remote buffer pairs only with its endpoint-qualified entry.
Source§impl Editor
impl Editor
pub fn enter_block_pub(&mut self)
pub fn block_rect_pub(&self) -> Option<BlockRect>
Source§impl Editor
impl Editor
pub fn trace_state(&mut self)
Source§impl Editor
impl Editor
pub fn document_analysis( &mut self, document: DocumentId, first: usize, last: usize, left: usize, width: usize, ) -> Option<Arc<FrameAnalysis>>
pub fn preview_analysis( &mut self, path: &Path, first: usize, last: usize, width: usize, ) -> Option<Arc<FrameAnalysis>>
pub fn search_summary( &self, query: &CompiledQuery, ) -> Option<&Result<SearchSummary, String>>
Source§impl Editor
impl Editor
pub fn set_head(&mut self, pos: impl Into<ByteOffset>)
Sourcepub fn extra_selections(&self) -> &[Selection]
pub fn extra_selections(&self) -> &[Selection]
Extra selections beyond the primary (0013).
pub fn flash_range(&self) -> Option<Range>
pub fn clamp_cursor(&mut self)
Sourcepub fn scroll_to_cursor(&mut self, rows: usize)
pub fn scroll_to_cursor(&mut self, rows: usize)
Keep the cursor on screen; rows = text area height. The
render loop calls this every frame, so it doubles as the
viewport-height feed for the H/M/L/zz/ctrl-d family.
Source§impl Editor
impl Editor
Sourcepub fn diag_counts(&self, idx: DocumentId) -> (usize, usize)
pub fn diag_counts(&self, idx: DocumentId) -> (usize, usize)
(errors, warnings) on the buffer — the modeline’s diag chips.
Sourcepub fn diag_message_at(
&self,
idx: DocumentId,
line_1based: usize,
) -> Option<(Severity, &str)>
pub fn diag_message_at( &self, idx: DocumentId, line_1based: usize, ) -> Option<(Severity, &str)>
The worst diagnostic’s (severity, message) on a 1-based line — the cursor line’s end-of-line note (0009 UX).
Sourcepub fn diag_ranges_at(
&self,
idx: DocumentId,
line_1based: usize,
) -> Vec<(usize, usize, Severity)>
pub fn diag_ranges_at( &self, idx: DocumentId, line_1based: usize, ) -> Vec<(usize, usize, Severity)>
Diagnostic spans on a 1-based line as (col, end_col, severity) — the undercurl layer (0009 UX). Same-line diags only; columns are byte offsets into the line.
Sourcepub fn diag_severity_at(
&self,
idx: DocumentId,
line_1based: usize,
) -> Option<Severity>
pub fn diag_severity_at( &self, idx: DocumentId, line_1based: usize, ) -> Option<Severity>
Worst diagnostic severity for a 1-based line of buffer idx, if
any (0001 pillar 4: merges with the git gutter). Per-buffer, so
panes show their own diagnostics.
Source§impl Editor
impl Editor
Sourcepub fn touch_mru(&mut self, i: DocumentId)
pub fn touch_mru(&mut self, i: DocumentId)
Mark a document most-recently-used.
Sourcepub fn cur(&self) -> &Document
pub fn cur(&self) -> &Document
The current document. Invariant: the editor always has one live document while it runs (closing the last one sets should_quit).
pub fn buf(&self) -> &Buffer
pub fn buf_mut(&mut self) -> BufferEdit<'_>
Sourcepub fn doc(&self, id: DocumentId) -> &Document
pub fn doc(&self, id: DocumentId) -> &Document
One document by id — stale ids panic: an id outliving its document is a bug, and the generation check is what keeps it from silently resolving to the wrong one (0014 wave 2).
Sourcepub fn current(&self) -> DocumentId
pub fn current(&self) -> DocumentId
The active document (derived: the active view’s document).
Sourcepub fn switch_to(&mut self, id: DocumentId)
pub fn switch_to(&mut self, id: DocumentId)
Switch the active view to a document.
Sourcepub fn sels(&self) -> &SelectionSet
pub fn sels(&self) -> &SelectionSet
The active view’s selections.
pub fn sels_mut(&mut self) -> &mut SelectionSet
Sourcepub fn view_rows(&self) -> usize
pub fn view_rows(&self) -> usize
The active view’s scroll offset. The active pane’s text-area height in rows (render-loop fed).
pub fn view_top(&self) -> usize
Sourcepub fn close_buffer(&mut self, force: bool) -> bool
pub fn close_buffer(&mut self, force: bool) -> bool
Close the current document; quits when the last one closes. Returns false when unsaved changes block the close. Generational ids mean no reindexing anywhere (0014 wave 2).
Sourcepub fn ctrl_c_quit(&mut self) -> bool
pub fn ctrl_c_quit(&mut self) -> bool
ctrl-c’s quit intent (0015): warn once when dirty work exists, force on the second press. Returns true when the app may exit.
Source§impl Editor
impl Editor
Sourcepub fn connect_events(&mut self, tx: EventSender)
pub fn connect_events(&mut self, tx: EventSender)
Connect the editor’s job channels to the app event channel (TUI only — headless keeps the raw channels for its drains). Late-attaching LSP servers forward through the retained sender.
Sourcepub fn handle_app_event(&mut self, ev: AppEvent)
pub fn handle_app_event(&mut self, ev: AppEvent)
Route one event to its handler (the per-event halves of the old drain loops; the drains call these in a try_recv loop).
Source§impl Editor
impl Editor
Sourcepub fn async_pending(&self) -> bool
pub fn async_pending(&self) -> bool
Outstanding finite work, independent of whether channels are forwarded.
Source§impl Editor
impl Editor
Sourcepub fn discover_git(&mut self)
pub fn discover_git(&mut self)
Discover the repository for the current buffer. Native work
runs on a worker (R6); the pure cached context lands through
GitJob::Context and invalidates the git view only when it
actually changed. A remote buffer discovers on its endpoint —
rev-parse --show-toplevel from the file’s directory, then the
context reads — through the bounded remote-execution boundary;
the local cwd is never consulted for it (0036 RW8).
Source§impl Editor
impl Editor
Sourcepub fn refresh_hunks(&mut self)
pub fn refresh_hunks(&mut self)
Register the next gutter diff. Render-safe (R6): pure checks and registration only — the diff itself runs on a worker against an immutable text snapshot.
Sourcepub fn sign_at(&self, line_1based: usize) -> Option<char>
pub fn sign_at(&self, line_1based: usize) -> Option<char>
Gutter sign for a 1-based buffer line: + add, ~ change,
- deletion below (0001 pillar 3.1).
Sourcepub fn sign_at_staged(&self, line_1based: usize) -> bool
pub fn sign_at_staged(&self, line_1based: usize) -> bool
Staged sign (HEAD↔index edge, 0014 wave 4): the line sits inside a staged hunk’s new side. Line alignment between index and live text is approximate when both sets exist — the gutter’s rule: unstaged wins, staged marks what’s already in the index.
Source§impl Editor
impl Editor
Sourcepub fn handle_git_job(&mut self, job: GitJob)
pub fn handle_git_job(&mut self, job: GitJob)
One git job result (TUI events land here directly — 0018; the headless drains call this too).
Source§impl Editor
impl Editor
pub fn surface(&self) -> Option<&Surface>
Sourcepub fn open_delta(
&mut self,
name: &str,
hunks: PreparedDiff,
origin: Option<HunkOrigin>,
commit: Option<CommitFiles>,
)
pub fn open_delta( &mut self, name: &str, hunks: PreparedDiff, origin: Option<HunkOrigin>, commit: Option<CommitFiles>, )
A diff surface from structured hunks (0010 §2). label heads the
stats row; origin is set only for working-tree hunk previews.
Source§impl Editor
impl Editor
pub fn request_open(&mut self, path: PathBuf, intent: OpenIntent)
pub fn request_target(&mut self, target: FileTarget, intent: OpenIntent)
pub fn request_save( &mut self, target: Option<PathBuf>, force: bool, close: bool, )
pub fn handle_io(&mut self, event: IoEvent)
pub fn io_pending(&self) -> bool
Source§impl Editor
impl Editor
Sourcepub fn lsp_start_services(&mut self)
pub fn lsp_start_services(&mut self)
Try to attach a language server for the current buffer. The
synchronous part only touches in-memory state; discovery
(config, root, trust, executability) is owned worker work behind the
replay gate.
The LSP half of the startup “start services” action: enable
attach, then attach for the current buffer. A pure state
transition performed identically live and replayed — the tape
gates the native discovery inside lsp_maybe_attach.
Source§impl Editor
impl Editor
pub fn lsp_sync_changed(&mut self)
Source§impl Editor
impl Editor
pub fn lsp_code_actions_pub(&mut self)
pub fn lsp_locations_pub(&mut self, kind: LocKind)
pub fn jump_diagnostic_pub(&mut self, forward: bool)
Source§impl Editor
impl Editor
Sourcepub fn ex_candidates(&self) -> Vec<(&'static str, &'static str)>
pub fn ex_candidates(&self) -> Vec<(&'static str, &'static str)>
Ex-completion candidates for the pending prefix (name, doc).
Source§impl Editor
impl Editor
Sourcepub fn search_pattern(&self) -> Option<&str>
pub fn search_pattern(&self) -> Option<&str>
Pending search pattern (incsearch highlight), if any: the / or
? prompt’s body. Pipe and ex bodies never misread as patterns.
Sourcepub fn enter_pub(&mut self)
pub fn enter_pub(&mut self)
vim Enter: [count] lines down, first non-blank. With the blame gutter on, Enter dives into the line’s commit instead (0011 §3).
pub fn run_motion(&mut self, keys: &str)
Source§impl Editor
impl Editor
Sourcepub fn preview(&self) -> Result<Option<(Vec<Range>, String)>, String>
pub fn preview(&self) -> Result<Option<(Vec<Range>, String)>, String>
The live preview: what would the pending keys do right now?
The plan the executor would apply — every cursor’s range (0014
wave 3): the preview cannot lie. Query errors surface as Err
(the modeline shows them); no operator or no origin means no
preview at all.
Source§impl Editor
impl Editor
Sourcepub fn find_candidates(&self) -> Option<FindPending>
pub fn find_candidates(&self) -> Option<FindPending>
Pending f/F/t/T awaiting its char: the leap-style candidates.
The WALKER owns that state — the old check read the free-text
line’s last byte, so any pattern ending in f/t (/const)
lit candidates over the cursor line (issue 13’s “stale match”).
Sourcepub fn current_search_query(&self) -> Result<Option<CompiledQuery>, QueryError>
pub fn current_search_query(&self) -> Result<Option<CompiledQuery>, QueryError>
The active query’s identity. Painting consumes its revision-matched worker summary; only grammatical test oracles enumerate all matches.
Source§impl Editor
impl Editor
pub fn picker_preview( &mut self, ) -> Option<(String, Option<usize>, PreviewSource)>
Source§impl Editor
impl Editor
pub fn open_picker(&mut self, kind: Kind)
Sourcepub fn close_picker(&mut self)
pub fn close_picker(&mut self)
Close the picker: revoke its active request, stop its worker, and cancel/forget the previews it owns (failed reads become retryable on reopen; successful caches survive).
pub fn picker_open(&self) -> bool
Source§impl Editor
impl Editor
Sourcepub fn paste_bracketed(&mut self, text: &str)
pub fn paste_bracketed(&mut self, text: &str)
Bracketed paste (0017): one undo unit, no key interpretation — the payload is text, not keystrokes. A live prompt consumes it through the pending reducer; an open picker pastes into its focused field; in normal mode it behaves like p; a trailing newline pastes linewise (vim’s paste plugin convention).
Source§impl Editor
impl Editor
pub fn remote_file(&self) -> Option<&RemoteFile>
pub fn remote_following(&self, document: DocumentId) -> bool
Source§impl Editor
impl Editor
pub fn new(buf: Buffer) -> Self
Sourcepub fn new_in(buf: Buffer, cwd: PathBuf) -> Self
pub fn new_in(buf: Buffer, cwd: PathBuf) -> Self
Pure construction. Native services start explicitly after forensic seeding.
pub fn feed_text(&mut self, text: &str)
pub fn feed(&mut self, key: Key)
Sourcepub fn input_normal(&self) -> bool
pub fn input_normal(&self) -> bool
True when a modal input field sits in normal mode (picker field or pending line) — the TUI draws the block cursor for it.
Sourcepub fn pending_sigil(&self) -> Option<char>
pub fn pending_sigil(&self) -> Option<char>
The modal line’s sigil when a free-text line is open (: / ? |)
— the ONE authority; the render card, the terminal’s bar-cursor
shape, and pending dispatch all ask here (a |sed s/a/b/ body
is a pipe, not a search).