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: PaneIdThis pane’s stable identity. Survives splits, closes of other panes and zoom; leaf indices do not.
buffer: BufferKindKind of the buffer shown, cached alongside buffer_id so layout
code can read it without a registry lookup.
buffer_id: BufferIdThe buffer this pane displays (on a published preview projection,
the previewed buffer — see committed_buffer_id).
cursor: PositionCursor inside the buffer. Loaded into App::cursor when the
pane becomes active; stashed back here when the pane goes
inactive.
scroll: u32First visible line in the pane. Loaded into App::scroll
when active.
leftcol: u32First 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: u32Per-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: u32Per-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
impl PaneState
Sourcepub fn is_previewing(&self) -> bool
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.
Sourcepub fn committed_id(&self) -> BufferId
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§
Auto Trait Implementations§
impl Freeze for PaneState
impl RefUnwindSafe for PaneState
impl Send for PaneState
impl Sync for PaneState
impl Unpin for PaneState
impl UnsafeUnpin for PaneState
impl UnwindSafe for PaneState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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