#[non_exhaustive]pub enum FoldOp {
Add {
start_row: usize,
end_row: usize,
closed: bool,
},
RemoveAt(usize),
OpenAt(usize),
CloseAt(usize),
ToggleAt(usize),
OpenAll,
CloseAll,
ClearAll,
Invalidate {
start_row: usize,
end_row: usize,
},
}Expand description
Canonical fold-mutation op carried through FoldProvider::apply.
Introduced in 0.0.38 (Patch C-δ.4). The engine raises one FoldOp
per z… keystroke / :fold* Ex command and dispatches it through
the FoldProvider::apply surface. Hosts that own the fold storage
(default in-tree wraps &mut hjkl_buffer::Buffer) decide how to
apply it — possibly batching, deduping, or vetoing. Hosts without
folds use NoopFoldProvider which silently discards every op.
FoldOp is engine-canonical (per the design doc’s resolved
question 8.2): hosts don’t invent their own fold-op enums. Each
host that exposes folds embeds a FoldOp variant in its Intent
enum (or simply observes the engine’s pending-fold-op queue via
crate::Editor::take_fold_ops).
Row indices are zero-based and match the row coordinate space used
by hjkl_buffer::Buffer’s fold methods.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Add
:fold {start,end} / zf{motion} / visual-mode zf — register a
new fold spanning [start_row, end_row] (inclusive). The closed
flag matches the underlying hjkl_buffer::Fold::closed.
RemoveAt(usize)
zd — drop the fold under row if any.
OpenAt(usize)
zo — open the fold under row if any.
CloseAt(usize)
zc — close the fold under row if any.
ToggleAt(usize)
za — flip the fold under row between open / closed.
OpenAll
zR — open every fold in the buffer.
CloseAll
zM — close every fold in the buffer.
ClearAll
zE — eliminate every fold.
Invalidate
Edit-driven fold invalidation. Drops every fold touching the
row range [start_row, end_row]. Mirrors vim’s “edits inside a
fold open it” behaviour. Fired by the engine’s edit pipeline,
not bound to a z… keystroke.
Trait Implementations§
impl Copy for FoldOp
impl Eq for FoldOp
impl StructuralPartialEq for FoldOp
Auto Trait Implementations§
impl Freeze for FoldOp
impl RefUnwindSafe for FoldOp
impl Send for FoldOp
impl Sync for FoldOp
impl Unpin for FoldOp
impl UnsafeUnpin for FoldOp
impl UnwindSafe for FoldOp
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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