Skip to main content

PaneState

Struct PaneState 

Source
pub struct PaneState {
    pub id: PaneId,
    pub buffer: BufferKind,
    pub buffer_id: BufferId,
    pub cursor: Position,
    pub scroll: u32,
    pub leftcol: u32,
    pub viewport_height: u32,
    pub viewport_width: u32,
    pub committed_buffer_id: Option<BufferId>,
    pub scroll_lines: Option<u32>,
}
Expand description

One leaf in the pane tree. Carries the per-pane viewport state for its content buffer; switching the active pane swaps these fields with App::cursor / App::scroll so motion code stays unchanged.

Fields§

§id: PaneId

This pane’s stable identity. Survives splits, closes of other panes and zoom; leaf indices do not.

§buffer: BufferKind

Kind of the buffer shown, cached alongside buffer_id so layout code can read it without a registry lookup.

§buffer_id: BufferId

The buffer this pane displays (on a published preview projection, the previewed buffer — see committed_buffer_id).

§cursor: Position

Cursor inside the buffer. Loaded into App::cursor when the pane becomes active; stashed back here when the pane goes inactive.

§scroll: u32

First visible line in the pane. Loaded into App::scroll when active.

§leftcol: u32

First visible display column in the pane (horizontal scroll). 0 = the line’s first column is at the left edge. Only meaningful when wrap is off; forced to 0 under wrap. Loaded into Editor::leftcol when the pane is active.

§viewport_height: u32

Per-pane visible-buffer height in screen rows. Issue #25 (2026-05-22): replaces the single Editor::viewport_height global as the source of truth for each pane. Each leaf gets its own height set by the renderer’s per-frame layout pass; the highlights worker reads active_pane.viewport_height (mirrored into Editor::viewport_height) so it computes the right number of lines for the active pane, and ensure_cursor_visible clamps against the active pane’s actual painted area regardless of how the tree is split.

§viewport_width: u32

Per-pane visible-buffer width in screen columns. Issue #25 follow-up: vertical splits halve the width — without per-pane width, line-wrap / clip math mismeasures the cursor’s end-of-line position in narrower panes. Set by the same per-frame layout pass that populates viewport_height.

§committed_buffer_id: Option<BufferId>

When this leaf is a published render projection of a pane that is currently previewing another buffer, the buffer_id / buffer / cursor / scroll fields above hold the DISPLAYED (previewed) buffer + its preview viewport, and this holds the pane’s COMMITTED buffer — what :ls, the modeline / per-pane status line, dispatch, and an accept all resolve. None means “not previewing” (buffer_id is both committed and displayed).

Always None in the live Editor::pane_tree; the authoritative override lives host-side in Editor::preview_overrides and is baked into the leaves only when the render state is published (build_render_state). Ephemeral: never persisted, never snapshotted. See docs/dev/architecture/preview-isolation.md §5.

Slice: PI.1 (preview isolation).

§scroll_lines: Option<u32>

This WINDOW’s scroll — how far <C-d> / <C-u> move, set by a count to either key. None means “this window has none”, and the distance falls back to the scroll option, then to half the window.

Per pane because vim’s scroll is window-local: two windows on the same buffer scroll by different amounts, and a count typed in one must not change the other. (The :set scroll=N OPTION is still global here — lattice has no window-local option layer — so it is the default a window with no count of its own uses.)

Cleared when the window is resized, as vim resets it to half the new height.

Slice: VM.3j-3.

Implementations§

Source§

impl PaneState

Source

pub fn is_previewing(&self) -> bool

Is this published leaf a preview projection (displaying a buffer other than the one it is committed to)?

Slice: PI.1.

Source

pub fn committed_id(&self) -> BufferId

The buffer a real switch / accept commits and that :ls, the modeline, and the per-pane status line report. Equals Self::buffer_id except on a published preview projection, where buffer_id is the displayed buffer and this is the committed one.

Slice: PI.1.

Trait Implementations§

Source§

impl Clone for PaneState

Source§

fn clone(&self) -> PaneState

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 PaneState

Source§

impl Debug for PaneState

Source§

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

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

impl Default for PaneState

Source§

fn default() -> PaneState

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
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.