pub struct BufferFoldProviderMut<'a> { /* private fields */ }Expand description
Mutable FoldProvider adapter wrapping a &mut hjkl_buffer::Buffer.
Engine call sites that need to dispatch a FoldOp (vim’s z…
keystrokes, the :fold* Ex commands, edit-pipeline invalidation)
construct this on the fly from &mut self.buffer and call
FoldProvider::apply / FoldProvider::invalidate_range on it.
Introduced in 0.0.38 (Patch C-δ.4) as part of routing fold mutation
through the FoldProvider surface. Fold storage still lives
on hjkl_buffer::Buffer for dirty_gen / render-cache reasons;
only the dispatch path moved.
Implementations§
Source§impl<'a> BufferFoldProviderMut<'a>
impl<'a> BufferFoldProviderMut<'a>
pub fn new(buffer: &'a mut RopeBuffer) -> Self
Trait Implementations§
Source§impl FoldProvider for BufferFoldProviderMut<'_>
impl FoldProvider for BufferFoldProviderMut<'_>
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 BufferFoldProviderMut<'a>
impl<'a> RefUnwindSafe for BufferFoldProviderMut<'a>
impl<'a> Send for BufferFoldProviderMut<'a>
impl<'a> Sync for BufferFoldProviderMut<'a>
impl<'a> Unpin for BufferFoldProviderMut<'a>
impl<'a> UnsafeUnpin for BufferFoldProviderMut<'a>
impl<'a> !UnwindSafe for BufferFoldProviderMut<'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