UndoBuffer

Trait UndoBuffer 

Source
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§

Source

fn undo_count(&self) -> u32

How many undoes are stored?

Source

fn set_undo_count(&mut self, n: u32)

How many undoes are stored?

Source

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.

Source

fn end_seq(&mut self)

End a sequence of changes that should be undone at once.

Source

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.

Source

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.

Source

fn clear(&mut self)

Clear the undo and the replay buffer.

Source

fn open_undo(&self) -> usize

Get the number of possible undo operations.

Source

fn open_redo(&self) -> usize

Get the number of possible redo operations.

Source

fn undo(&mut self) -> Vec<&UndoOp>

Get the list of the next undo operations.

Source

fn redo(&mut self) -> Vec<&UndoOp>

Get the list of the next redo operations.

Source

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.

Source

fn has_replay_log(&self) -> bool

Is the replay-log active?

Source

fn recent_replay_log(&mut self) -> Vec<UndoEntry>

Get the replay-log to sync with another textarea. This empties the replay buffer.

Source

fn undo_styles_enabled(&self) -> bool

Is there undo for setting/removing styles.

Implementors§