Skip to main content

BufferFoldProvider

Struct BufferFoldProvider 

Source
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>

Source

pub fn new(buffer: &'a RopeBuffer) -> Self

Trait Implementations§

Source§

impl FoldProvider for BufferFoldProvider<'_>

Source§

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>

First visible row strictly before row. None past the top.
Source§

fn is_row_hidden(&self, row: usize) -> bool

Is row currently hidden by a closed fold?
Source§

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)

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 more
Source§

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§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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
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.