UndoState

Class

Common
class UndoState internal constructor(private val state: TextFieldState)

Defines an interactable undo history.

Properties

Common
val canUndo: Boolean

Whether it is possible to execute a meaningful undo action right now. If this value is false, calling undo would be a no-op.

Common
val canRedo: Boolean

Whether it is possible to execute a meaningful redo action right now. If this value is false, calling redo would be a no-op.

Functions

fun undo()

Reverts the latest edit action or a group of actions that are merged together. Calling it repeatedly can continue undoing the previous actions.

fun redo()

Re-applies a change that was previously reverted via undo.

fun clearHistory()

Clears all undo and redo history up to this point.