Package-level declarations

Types

Link copied to clipboard
interface Batch

A Batch is part of a History and is made up of a list of Changes. Undo and redo work on batches, not on individual changes.

Link copied to clipboard
interface Change

See History and Batch.

Link copied to clipboard
interface ChangeImpl : Change

All concrete implementations of Change must also implement this. However, the public API must never expose this implementation, because undo and redo must only be called by History.

Link copied to clipboard
Link copied to clipboard
class History(val document: HistoryDocument)

The mechanism underlying undo and redo. It is called History, because I think of undo as going back in time, and redo as going forward in time.

Link copied to clipboard
interface HistoryDocument

A document with a History, allowing undo and redo actions.

Link copied to clipboard
Link copied to clipboard

Changes which do not change the model's data are skippable. e.g. changes to the current selection are SkippableChanges.

Link copied to clipboard

Using weak listeners can help prevent memory leaks.

Functions

Link copied to clipboard
fun documentListener(lambda: (document: HistoryDocument, change: Change, isUndo: Boolean) -> Unit): DocumentListener