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<(), Error>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoMaybeUndefined<T> for T

§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
§

impl<T> IntoOption<T> for T

§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Pointer = u32

§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> ResetDiscriminant<T> for T
where T: Copy,

§

fn discriminant(&self) -> T

Value based on which equality for the reset will be determined.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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