public class UndoState internal constructor(private val state: TextFieldState)
Controls the undo and redo history for a TextFieldState.
Properties
canUndo
public val canUndo: Boolean
Whether an undo action can currently be performed.
If this value is false, calling undo is a no-op. This property is backed by snapshot state and will cause recomposition when its value changes.
canRedo
public val canRedo: Boolean
Whether a redo action can currently be performed.
If this value is false, calling redo is a no-op. This property is backed by snapshot state and will cause recomposition when its value changes.
Functions
undo
public fun undo()
Reverts the latest edit action or a group of actions that are merged together.
If canUndo is false, this is a no-op. Calling it repeatedly continues undoing previous actions.
redo
public fun redo()
Re-applies a change that was previously reverted via undo.
If canRedo is false, this is a no-op.
clearHistory
public fun clearHistory()
Clears all undo and redo history up to this point.
Calling this sets both canUndo and canRedo to false.