UndoEngine

interface UndoEngine

Thread-affine asynchronous project history. Its methods are called on the model thread; completions may arrive on any thread.

Inheritors

AndroidUndoEngine
JsUndoEngine
JvmUndoEngine
NativeUndoEngine
WasmJsUndoEngine

Properties

Link copied to clipboard
abstract val state: UndoState

Functions

Link copied to clipboard
abstract fun beginCompound(description: String, origin: MutationOrigin = MutationOrigin.User): UndoResult

Opens one named history step. Operations performed while it is open are applied immediately but enter history only when endCompound succeeds. Nested compounds are deliberately rejected.

Link copied to clipboard
abstract fun beginGesture(description: String, origin: MutationOrigin = MutationOrigin.User): UndoResult

A gesture is a named compound scope that coalesces adjacent compatible operations: intermediate values are applied, but history retains only the initial and final ones.

Link copied to clipboard
abstract fun cancelCompound(completion: (UndoResult) -> Unit? = null)

Reverts every successfully performed child in reverse order.

Link copied to clipboard
abstract fun cancelGesture(completion: (UndoResult) -> Unit? = null)
Link copied to clipboard
abstract fun clear(markCurrentStateSaved: Boolean = true): Boolean

Fails while an operation is pending or a compound step is open.

Link copied to clipboard
abstract fun endCompound(completion: (UndoResult) -> Unit? = null)
Link copied to clipboard
abstract fun endGesture(completion: (UndoResult) -> Unit? = null)
Link copied to clipboard
abstract fun markSaved(): Boolean
Link copied to clipboard
abstract fun markStateSaved(stateId: Long): Boolean
Link copied to clipboard
abstract fun redo(completion: (UndoResult) -> Unit? = null)
Link copied to clipboard
Link copied to clipboard
abstract fun shutdown()

Rejects new work and completes pending notification as Cancelled.

Link copied to clipboard
abstract fun undo(completion: (UndoResult) -> Unit? = null)