#[non_exhaustive]pub enum UndoOp {
InsertChar {
bytes: Range<usize>,
cursor: TextPositionChange,
anchor: TextPositionChange,
txt: String,
},
InsertStr {
bytes: Range<usize>,
cursor: TextPositionChange,
anchor: TextPositionChange,
txt: String,
},
RemoveChar {
bytes: Range<usize>,
cursor: TextPositionChange,
anchor: TextPositionChange,
txt: String,
styles: Vec<StyleChange>,
},
RemoveStr {
bytes: Range<usize>,
cursor: TextPositionChange,
anchor: TextPositionChange,
txt: String,
styles: Vec<StyleChange>,
},
Cursor {
cursor: TextPositionChange,
anchor: TextPositionChange,
},
SetStyles {
styles_before: Vec<(Range<usize>, usize)>,
styles_after: Vec<(Range<usize>, usize)>,
},
SetText {
txt: String,
},
Undo,
Redo,
}Expand description
Storage for undo.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InsertChar
Insert a single char/grapheme.
This can contain a longer text, if consecutive InsertChar have been merged.
Fields
cursor: TextPositionChangecursor position change
anchor: TextPositionChangeanchor position change
InsertStr
Insert a longer text.
Fields
cursor: TextPositionChangecursor position change
anchor: TextPositionChangeanchor position change
RemoveChar
Remove a single char/grapheme range.
This can be a longer range, if consecutive RemoveChar have been merged.
styles contains only styles whose range intersects the removed range. Styles that lie after the bytes-range will be shifted left.
Fields
cursor: TextPositionChangecursor position change
anchor: TextPositionChangeanchor position change
styles: Vec<StyleChange>removed styles
RemoveStr
Remove longer text range.
styles contains only styles whose range intersects the removed range. Styles that lie after the bytes-range will be shifted left.
Fields
cursor: TextPositionChangecursor position change
anchor: TextPositionChangeanchor position change
styles: Vec<StyleChange>removed styles
Cursor
Cursor/anchor changed.
This will be merged with a cursor-change immediately before. And it will merge with both removes and inserts.
Fields
cursor: TextPositionChangecursor position change
anchor: TextPositionChangeanchor position change
SetStyles
Set of styles was replaced.
Fields
SetText
For replay only. Complete content was replaced.
Undo
For replay only. Undo one operation.
Redo
For replay only. Redo one operation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UndoOp
impl RefUnwindSafe for UndoOp
impl Send for UndoOp
impl Sync for UndoOp
impl Unpin for UndoOp
impl UnwindSafe for UndoOp
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<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