pub enum FoldRecomputeCause {
Populate,
Edit,
}Expand description
Why crate::editor::Editor::recompute_folds_because is running, and so
whether foldlevel gets to seed the folds it has not seen before.
fold-architecture.md states that foldlevel “applies as a bulk action,
not a standing invariant” — apply_fold_level_to_new is the narrow
exception that lets it decide the initial state of structure that shows up
later. On the edit path that exception had grown back into the invariant it
was carved out of: every keystroke that created a fold handed foldlevel a
fold it had never seen, and at org’s foldlevel=0 that fold closed under
the cursor. o on a bare headline was the purest case — a headline with no
body produces no fold at all, so opening a line under it makes one appear
for the very first time, mid-insert.
Variants§
Populate
Content arrived from somewhere other than the user’s hands: buffer
activation, a late syntax attach, an async provider batch, an LSP
folding-range response. This is structure the user has genuinely not
seen, so foldlevel seeds it — org opens on an overview, :set foldlevel=0 keeps collapsing a project diff whose hunks are still
streaming in.
Edit
The user’s own edit reshaped the buffer. foldlevel gets no vote: a
fold that exists because a keystroke just created it is not structure
the user has yet to see — they are looking at it, and usually typing
inside it. Emacs (#+STARTUP: overview) and vim (foldlevelstart)
both treat level-driven collapse as an opening act for the same reason.
Trait Implementations§
Source§impl Clone for FoldRecomputeCause
impl Clone for FoldRecomputeCause
Source§fn clone(&self) -> FoldRecomputeCause
fn clone(&self) -> FoldRecomputeCause
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FoldRecomputeCause
Source§impl Debug for FoldRecomputeCause
impl Debug for FoldRecomputeCause
impl Eq for FoldRecomputeCause
Source§impl PartialEq for FoldRecomputeCause
impl PartialEq for FoldRecomputeCause
impl StructuralPartialEq for FoldRecomputeCause
Auto Trait Implementations§
impl Freeze for FoldRecomputeCause
impl RefUnwindSafe for FoldRecomputeCause
impl Send for FoldRecomputeCause
impl Sync for FoldRecomputeCause
impl Unpin for FoldRecomputeCause
impl UnsafeUnpin for FoldRecomputeCause
impl UnwindSafe for FoldRecomputeCause
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