Skip to main content

TerminalSnapshot

Struct TerminalSnapshot 

Source
pub struct TerminalSnapshot {
    pub cells: Arc<[Cell]>,
    pub rows: u16,
    pub cols: u16,
    pub cursor_row: u16,
    pub cursor_col: u16,
    pub cursor_visible: bool,
    pub cursor_shape: CursorShape,
    pub title: Option<String>,
    pub alt_screen: bool,
    pub scroll_offset: u32,
    pub scrollback_rows: u32,
    pub seq: u64,
}
Expand description

One published frame. Renderer reads via Arc<ArcSwap<TerminalSnapshot>> — .load() is wait-free.

The cells slice is row-major: cell at (row, col) lives at cells[row * cols + col]. Always exactly rows * cols long.

seq is a monotonic frame counter — renderers can skip a repaint when the loaded snapshot’s seq matches the last-painted one.

Fields§

§cells: Arc<[Cell]>§rows: u16§cols: u16§cursor_row: u16§cursor_col: u16§cursor_visible: bool§cursor_shape: CursorShape§title: Option<String>

None = no OSC 0/2 title received yet; renderer falls back to the buffer’s label.

§alt_screen: bool

True while the program is on the xterm “alternate screen” buffer (vim, less, htop, etc.). Renderers can use this to disable the modeline-scrollback indicator.

§scroll_offset: u32

T3 (2026-05-25): rows scrolled back from the live edge. 0 = live; positive values expose scrollback. Renderers surface this on the modeline so the user can tell at a glance they’re viewing history.

§scrollback_rows: u32

T3 (2026-05-25): current number of rows held in scrollback (history that has scrolled off the live screen). Grows as rows roll off; bounded by the configured terminal.scrollback-lines. Used by the modeline / status line to render a “row N of M” indicator and to gate scroll-up motions.

§seq: u64

Monotonic per-terminal frame counter.

Implementations§

Source§

impl TerminalSnapshot

Source

pub fn empty() -> Self

Empty 24×80 snapshot — the vim/xterm-conventional fallback size for contexts with no real spawn geometry yet (tests, Default). NOT used by spawn()’s initial publish — see Self::empty_sized.

Source

pub fn empty_sized(rows: u16, cols: u16) -> Self

Empty snapshot at a CALLER-SUPPLIED size. spawn() publishes this (at the real SpawnConfig::{rows,cols}) as the placeholder shown before the reader thread processes the child’s first output chunk.

Regression (2026-07-02): spawn() used to publish Self::empty() unconditionally — a hardcoded 24×80 disconnected from the real spawn size. The alacritty Term (build_term) and the kernel PTY (openpty) were ALWAYS sized correctly from SpawnConfig; only this placeholder lied about it. When the real pane is taller than 24 rows (the common case), a paint landing in the placeholder’s brief window caps rows_to_paint at 24, and — critically — the mismatch does NOT self-correct via a renderer resize the way the old doc comment claimed: SetPaneViewport’s diff-then-send gate only fires a PTY resize when the computed row count DIFFERS from the pane’s already- published viewport_height, which do_terminal_spawn already read to size the spawn — so there is no delta to trigger a correcting resize. The window closes only once the reader thread republishes a snapshot from real output, whenever that first arrives.

Source

pub fn cell_at(&self, row: u16, col: u16) -> Cell

Cell at (row, col). Returns the default cell (space on default bg/fg) for out-of-range indices so renderers can iterate naively without bounds checks.

Trait Implementations§

Source§

impl Clone for TerminalSnapshot

Source§

fn clone(&self) -> TerminalSnapshot

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 Debug for TerminalSnapshot

Source§

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

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

impl Default for TerminalSnapshot

Source§

fn default() -> Self

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

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<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more