pub struct PaneBufferHistory { /* private fields */ }Expand description
One pane’s buffer trail plus the walk cursor.
entries is oldest → newest; cursor indexes the entry currently
displayed. Browser / jump-list semantics: visiting a new buffer while
walked back truncates the forward tail.
Implementations§
Source§impl PaneBufferHistory
impl PaneBufferHistory
Sourcepub fn seeded(entry: PaneHistoryEntry) -> Self
pub fn seeded(entry: PaneHistoryEntry) -> Self
Seed a pane’s history with the buffer it is already showing, so
the first <C-6> has an origin to go back from.
pub fn entries(&self) -> &[PaneHistoryEntry]
pub fn cursor(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn current(&self) -> Option<&PaneHistoryEntry>
pub fn current(&self) -> Option<&PaneHistoryEntry>
The entry currently displayed, if any.
Sourcepub fn update_current_position(&mut self, cursor: Position, scroll: u32)
pub fn update_current_position(&mut self, cursor: Position, scroll: u32)
Update the current entry’s cursor/scroll — the pane’s outgoing position, captured just before leaving for another buffer so walking back returns to where the user actually was.
Sourcepub fn repoint_current(&mut self, buffer: BufferId)
pub fn repoint_current(&mut self, buffer: BufferId)
Point the current entry at a different buffer id without moving the trail.
For :e! — a reload replaces the buffer actor (new
BufferId) while the pane keeps showing the same file. Pushing
would put the same path in the trail twice for what the user
experiences as a refresh; leaving it alone would strand the
entry on a dead id.
Sourcepub fn push(&mut self, entry: PaneHistoryEntry, cap: usize)
pub fn push(&mut self, entry: PaneHistoryEntry, cap: usize)
Record a visit to entry, truncating any forward tail.
cap bounds the ring (pane.buffer-history-size); the oldest
entries are evicted and cursor shifts down with them so the
current position does not drift onto a different buffer.
A visit to the buffer already current is ignored — the recording chokepoint guards on this too, but keeping the structure idempotent means a second caller can’t corrupt the trail.
Sourcepub fn back(&mut self) -> Option<PaneHistoryEntry>
pub fn back(&mut self) -> Option<PaneHistoryEntry>
Step back one entry, returning the entry now current.
None at the oldest entry — the caller echoes rather than
wrapping. Wrapping would turn a directional key into a cycle.
A walk never records. Moving the cursor is the whole operation; pushing here would make the forward direction unreachable.
Sourcepub fn forward(&mut self) -> Option<PaneHistoryEntry>
pub fn forward(&mut self) -> Option<PaneHistoryEntry>
Step forward one entry, returning the entry now current. None
at the newest entry.
Sourcepub fn jump_to(&mut self, index: usize) -> Option<PaneHistoryEntry>
pub fn jump_to(&mut self, index: usize) -> Option<PaneHistoryEntry>
Move the walk cursor to an explicit index — the picker’s random-access walk. Accepting a picker row is not a new visit, so this moves rather than pushes. Out-of-range is a no-op.
Sourcepub fn retain_live<F>(&mut self, still_live: F)
pub fn retain_live<F>(&mut self, still_live: F)
Drop every entry whose buffer still_live rejects, keeping the
walk cursor on the nearest surviving entry.
Buffers deleted with :bd are pruned lazily as the walk passes
them rather than eagerly on delete — that keeps :bd from having
to know about a structure it should not know about.
Trait Implementations§
Source§impl Clone for PaneBufferHistory
impl Clone for PaneBufferHistory
Source§fn clone(&self) -> PaneBufferHistory
fn clone(&self) -> PaneBufferHistory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaneBufferHistory
impl Debug for PaneBufferHistory
Source§impl Default for PaneBufferHistory
impl Default for PaneBufferHistory
Source§fn default() -> PaneBufferHistory
fn default() -> PaneBufferHistory
impl Eq for PaneBufferHistory
Source§impl PartialEq for PaneBufferHistory
impl PartialEq for PaneBufferHistory
impl StructuralPartialEq for PaneBufferHistory
Auto Trait Implementations§
impl Freeze for PaneBufferHistory
impl RefUnwindSafe for PaneBufferHistory
impl Send for PaneBufferHistory
impl Sync for PaneBufferHistory
impl Unpin for PaneBufferHistory
impl UnsafeUnpin for PaneBufferHistory
impl UnwindSafe for PaneBufferHistory
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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