pub struct BufferFoldProvider<'a> { /* private fields */ }Expand description
FoldProvider adapter wrapping a &hjkl_buffer::Buffer. Lets
engine call sites ask the buffer’s fold storage about visible
rows without reaching into Buffer::next_visible_row &c. directly.
Construct with BufferFoldProvider::new. Hosts that want to
expose their own fold model (a separate fold tree, LSP-derived
folding ranges, …) can implement FoldProvider against their own
state and skip this adapter entirely.
Introduced in 0.0.32 (Patch C-β) as part of the fold-iteration
relocation. Fold storage still lives on the buffer for
dirty_gen / render-cache reasons; only the iteration API moved.
Implementations§
Source§impl<'a> BufferFoldProvider<'a>
impl<'a> BufferFoldProvider<'a>
pub fn new(buffer: &'a RopeBuffer) -> Self
Trait Implementations§
Source§impl FoldProvider for BufferFoldProvider<'_>
impl FoldProvider for BufferFoldProvider<'_>
Source§fn next_visible_row(&self, row: usize, _row_count: usize) -> Option<usize>
fn next_visible_row(&self, row: usize, _row_count: usize) -> Option<usize>
First visible row strictly after
row, skipping hidden rows.
None past the end of the buffer.Source§fn prev_visible_row(&self, row: usize) -> Option<usize>
fn prev_visible_row(&self, row: usize) -> Option<usize>
First visible row strictly before
row. None past the top.Is
row currently hidden by a closed fold?Source§fn fold_at_row(&self, row: usize) -> Option<(usize, usize, bool)>
fn fold_at_row(&self, row: usize) -> Option<(usize, usize, bool)>
Range
(start_row, end_row, closed) of the fold containing
row, if any. Lets za / zo / zc find their target
without iterating the full fold list.Source§fn apply(&mut self, op: FoldOp)
fn apply(&mut self, op: FoldOp)
Apply a
FoldOp to the underlying fold storage. Read-only
providers (e.g. crate::buffer_impl::BufferFoldProvider which
holds a &Buffer) and providers that don’t track folds (e.g.
NoopFoldProvider) implement this as a no-op. Read moreSource§fn invalidate_range(&mut self, start_row: usize, end_row: usize)
fn invalidate_range(&mut self, start_row: usize, end_row: usize)
Drop every fold whose range overlaps
[start_row, end_row].
Edit pipelines call this after a user edit so vim’s “edits
inside a fold open it” behaviour fires. Default impl forwards
to FoldProvider::apply with a FoldOp::Invalidate.Auto Trait Implementations§
impl<'a> Freeze for BufferFoldProvider<'a>
impl<'a> RefUnwindSafe for BufferFoldProvider<'a>
impl<'a> Send for BufferFoldProvider<'a>
impl<'a> Sync for BufferFoldProvider<'a>
impl<'a> Unpin for BufferFoldProvider<'a>
impl<'a> UnsafeUnpin for BufferFoldProvider<'a>
impl<'a> UnwindSafe for BufferFoldProvider<'a>
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
Mutably borrows from an owned value. Read more
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>
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 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>
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