pub struct History { /* private fields */ }Expand description
The linear undo log.
ARCHITECTURE.md §8 wants one undo path for all sources; a linear stack delivers that. Helix’s undo tree is strictly more powerful, and is additive on top of this log if V1 ever needs it — the log is the hard part and we are building it either way.
Implementations§
Source§impl History
impl History
pub fn new() -> Self
Sourcepub fn group_for(&mut self, source: &EditSource) -> UndoGroupId
pub fn group_for(&mut self, source: &EditSource) -> UndoGroupId
The undo group a new edit from source belongs to.
Consecutive typing merges; anything else starts a fresh group, as does an explicit
break_group from a cursor move or a save.
Sourcepub fn break_group(&mut self)
pub fn break_group(&mut self)
End the current undo group, so the next edit starts a new one.
Called on a cursor move, a save, or an idle timeout — the boundaries a user intuitively expects undo to stop at.
Sourcepub fn push(&mut self, transaction: &EditTransaction, inverse: ChangeSet)
pub fn push(&mut self, transaction: &EditTransaction, inverse: ChangeSet)
Record a transaction that has just been applied, with the inverse computed against the document as it was before the change.
pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
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 UnsafeUnpin 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