pub trait UndoBuffer: DynClone + Debug {
Show 15 methods
// Required methods
fn undo_count(&self) -> u32;
fn set_undo_count(&mut self, n: u32);
fn begin_seq(&mut self);
fn end_seq(&mut self);
fn append(&mut self, undo: UndoOp);
fn append_from_replay(&mut self, undo: UndoEntry);
fn clear(&mut self);
fn open_undo(&self) -> usize;
fn open_redo(&self) -> usize;
fn undo(&mut self) -> Vec<&UndoOp>;
fn redo(&mut self) -> Vec<&UndoOp>;
fn enable_replay_log(&mut self, replay: bool);
fn has_replay_log(&self) -> bool;
fn recent_replay_log(&mut self) -> Vec<UndoEntry>;
fn undo_styles_enabled(&self) -> bool;
}Expand description
Undo buffer.
Keeps up to undo_count operations that can be undone/redone.
Additionally, it can provide a change-log which can be used to sync other text-widgets.
Required Methods§
Sourcefn undo_count(&self) -> u32
fn undo_count(&self) -> u32
How many undoes are stored?
Sourcefn set_undo_count(&mut self, n: u32)
fn set_undo_count(&mut self, n: u32)
How many undoes are stored?
Sourcefn begin_seq(&mut self)
fn begin_seq(&mut self)
Begin a sequence of changes that should be undone at once.
begin/end calls can be nested, but only the outer one will define the actual scope of the undo.
A call to begin_seq must be matched with a call to end_seq.
Sourcefn append(&mut self, undo: UndoOp)
fn append(&mut self, undo: UndoOp)
Appends a new operation at the current undo-position.
Redoes will be truncated by this call.
This call tries merge InsertChar/RemoveChar operations, if they lie next to each other. InsertStr/RemoveStr will never be merged.
Sourcefn append_from_replay(&mut self, undo: UndoEntry)
fn append_from_replay(&mut self, undo: UndoEntry)
Appends a new operation but doesn’t fill the replay-log.
Used to add to the undo-buffer during replay from another text-widget.
Sourcefn enable_replay_log(&mut self, replay: bool)
fn enable_replay_log(&mut self, replay: bool)
Enable/disable replay recording.
Attention: For this to work the widget state must be in a ‘cleared’ state, or you must create a clone of the widget-state immediately after activating the replay-log.
Only then the replay operations obtained by recent_replay() will make sense to the clone.
Info: How you identify the widgets that should receive the replay-log and other distribution problems are in the domain of the user of this feature.
Sourcefn has_replay_log(&self) -> bool
fn has_replay_log(&self) -> bool
Is the replay-log active?
Sourcefn recent_replay_log(&mut self) -> Vec<UndoEntry>
fn recent_replay_log(&mut self) -> Vec<UndoEntry>
Get the replay-log to sync with another textarea. This empties the replay buffer.
Sourcefn undo_styles_enabled(&self) -> bool
fn undo_styles_enabled(&self) -> bool
Is there undo for setting/removing styles.