pub struct SessionHistory { /* private fields */ }Expand description
Undo/redo stacks for a session.
Implementations§
Source§impl SessionHistory
impl SessionHistory
Sourcepub fn new() -> Self
pub fn new() -> Self
History capped at DEFAULT_UNDO_DEPTH turns.
Sourcepub fn with_depth(depth: usize) -> Self
pub fn with_depth(depth: usize) -> Self
History keeping at most depth undo entries (0 = unlimited). The
oldest entries drop first.
pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
Sourcepub fn exhausted_depth(&self) -> Option<usize>
pub fn exhausted_depth(&self) -> Option<usize>
Some(undo_depth) when nothing is left to undo because the cap
dropped older turns, so /undo can say why it stops there.
Sourcepub fn push_before_turn(
&mut self,
messages: &[Message],
project_path: &Path,
) -> StashSlot
pub fn push_before_turn( &mut self, messages: &[Message], project_path: &Path, ) -> StashSlot
Capture current messages before a user turn and start git stash create on a background thread. Wait on the returned slot before the
turn can edit files, so the stash shows the tree the user had.
Sourcepub fn mark_new_files(&mut self, files: Vec<PathBuf>)
pub fn mark_new_files(&mut self, files: Vec<PathBuf>)
Record untracked files created during the last turn (for cleanup on undo).
Trait Implementations§
Source§impl Clone for SessionHistory
impl Clone for SessionHistory
Source§impl Debug for SessionHistory
impl Debug for SessionHistory
Auto Trait Implementations§
impl Freeze for SessionHistory
impl RefUnwindSafe for SessionHistory
impl Send for SessionHistory
impl Sync for SessionHistory
impl Unpin for SessionHistory
impl UnsafeUnpin for SessionHistory
impl UnwindSafe for SessionHistory
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
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