pub struct History { /* private fields */ }Available on crate feature
editor only.Expand description
Manages undo/redo history for the editor.
Implementations§
Source§impl History
impl History
Sourcepub fn with_config(config: HistoryConfig) -> Self
pub fn with_config(config: HistoryConfig) -> Self
Create with custom configuration.
Sourcepub fn push(&mut self, content: String, cursors: CursorSet)
pub fn push(&mut self, content: String, cursors: CursorSet)
Record a new state in history.
This will clear the redo stack and potentially coalesce with the previous entry if the edit happened within the coalesce window.
Sourcepub fn push_checkpoint(&mut self, content: String, cursors: CursorSet)
pub fn push_checkpoint(&mut self, content: String, cursors: CursorSet)
Record a state without coalescing (for explicit save points).
Sourcepub fn undo(
&mut self,
current_content: &str,
current_cursors: &CursorSet,
) -> Option<HistoryEntry>
pub fn undo( &mut self, current_content: &str, current_cursors: &CursorSet, ) -> Option<HistoryEntry>
Undo the last change.
Returns the previous state if available.
Sourcepub fn redo(
&mut self,
current_content: &str,
current_cursors: &CursorSet,
) -> Option<HistoryEntry>
pub fn redo( &mut self, current_content: &str, current_cursors: &CursorSet, ) -> Option<HistoryEntry>
Redo the last undone change.
Returns the next state if available.
Sourcepub fn undo_count(&self) -> usize
pub fn undo_count(&self) -> usize
Get the number of undo entries.
Sourcepub fn redo_count(&self) -> usize
pub fn redo_count(&self) -> usize
Get the number of redo entries.
Sourcepub fn begin_undo(&mut self)
pub fn begin_undo(&mut self)
Mark that we’re in the middle of an undo/redo operation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnwindSafe for History
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> 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 moreSource§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.