Skip to main content

BufferKind

Enum BufferKind 

Source
pub enum BufferKind {
    Document,
    Help,
    FileTree,
    Oil,
    Terminal,
    Messages,
    Multibuffer,
    Dashboard,
}
Expand description

Which kind of buffer the App’s input pipeline currently routes to. The chord grammar, motions, and position history are shared; kind only matters at a few discrete decision points: which cursor a motion mutates, whether mutating actions are accepted (most non-document kinds are read-only), and which buffer-local bindings apply (Help binds <CR> to follow-link, FileTree binds <CR> to follow-entry, etc.).

Variants§

§

Document

The user’s edit-target – one Document today.

§

Help

A :describe-* / :apropos / :keymap view. Read-only; motions / yank work, edits don’t.

§

FileTree

Filesystem hierarchy view (DESIGN.md §5.9 buffer-as-content). Rope-backed with one rendered line per visible entry; <CR> on a directory toggles expansion, on a file opens it as a new Document buffer.

§

Oil

Flat editable directory listing (oil.nvim-style). Writable — operators and motions run against the oil rope; :w diffs the rope against its snapshot and executes renames/deletes/creates on disk.

§

Terminal

PTY-backed terminal buffer (issue #40, T1 / Terminal-mode). Owns a child process via lattice-terminal::PtyHandle; the reader task publishes TerminalSnapshots the renderer paints as a cell grid. Two sub-states (T2): Normal-in-terminal (vim motions over the scrollback) and Terminal-Insert (keystrokes encoded → PTY stdin). NOT editable via the standard rope operator path — is_read_only() returns true so the operator dispatcher leaves it alone.

§

Messages

*messages* audit-log buffer (DESIGN.md §5.10.6 / emacs’ *Messages* analogue). Rope-backed like Document internally — its mode (messages-mode) contributes ReadOnly = true so the dispatcher gates keystrokes, and NoFile = true so :q skips its dirty check. The kind is distinct so introspection (:ls, modeline) doesn’t conflate the transcript with user-edited documents.

§

Multibuffer

Composed view over N source buffers, owned by lattice_multibuffer::MultibufferDocumentHandle. Read-only in M.1; edit propagation lands in M.3. MultibufferMode (the major mode registered against this kind in M.2.b.2) owns the typed handle as its per-buffer context Guard, plus the ]e / [e / ]E / [E motion keymap. See docs/dev/architecture/multibuffer-views.md §3.6.

Slice: M.2.b.1 (2026-05-31).

§

Dashboard

*dashboard* launch page (DB.2, docs/dev/architecture/dashboard.md). Rope-backed like Document; its major mode (dashboard-mode) contributes ReadOnly = true + NoFile = true so the dispatcher gates keystrokes and :q skips its dirty check. Behaviourally a read-only, link-bearing, help-style buffer — it is grouped with BufferKind::Help in the <CR>-follow / Esc-dismiss gates (input.rs, dispatch.rs) and reuses the help link machinery, while staying a distinct kind so :ls / introspection don’t conflate it with the transcript or user documents.

Implementations§

Source§

impl BufferKind

Source

pub fn is_read_only(self) -> bool

Whether mutating operators (delete, change, paste, insert) are accepted on this kind. Only BufferKind::Document and BufferKind::Oil are writable; Terminal mutates via its own PTY-stdin path, not through rope operators. Messages is read-only at the dispatcher level (messages-mode contributes ReadOnly); subsystem appends bypass via the edit-batch path.

Source

pub fn label(self) -> &'static str

Short label for echo-area diagnostics.

Trait Implementations§

Source§

impl Clone for BufferKind

Source§

fn clone(&self) -> BufferKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BufferKind

Source§

impl Debug for BufferKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BufferKind

Source§

fn default() -> BufferKind

Returns the “default value” for a type. Read more
Source§

impl Eq for BufferKind

Source§

impl Hash for BufferKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BufferKind

Source§

fn eq(&self, other: &BufferKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BufferKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.