Skip to main content

AtomHistory class

Namespace: Arlecchino.Atoms · Assembly: Arlecchino.Core

Undo and redo over every TrackedAtom, collecting from the moment it exists. The stack is bounded, and steps past AtomHistory.Capacity fall off the far end.

public sealed class AtomHistory : IDisposable

Implements IDisposable

Constructors

MemberSummary
AtomHistory()Starts collecting edits.

Properties

MemberSummary
CanRedoWhether an undone step can be applied again.
CanUndoWhether there is a step to undo.
CapacityHow many steps to keep. Lowering it drops the oldest straight away; anything below one step is treated as one, since a history that remembers nothing is what LocalAtom is for.
DepthHow many steps are on the undo stack.

Methods

MemberSummary
Clear()Forgets both stacks. The hosted service does this once the application is up, so wiring does not end up as the first undo step.
Dispose()Stops collecting edits.
Group()Collects everything written until the scope is disposed into a single undo step. A group opened inside another joins it rather than closing it early.
Redo()Applies an undone step again. Writing something new drops this branch.
Undo()Takes back the last step. Undoing does not itself become a step.

Constructors in detail

AtomHistory()

public AtomHistory();

Starts collecting edits.

Properties in detail

CanRedo

public bool CanRedo { get; }

Whether an undone step can be applied again.

Type bool

CanUndo

public bool CanUndo { get; }

Whether there is a step to undo.

Type bool

Capacity

public int Capacity { get; set; }

How many steps to keep. Lowering it drops the oldest straight away; anything below one step is treated as one, since a history that remembers nothing is what LocalAtom is for.

Type int

Depth

public int Depth { get; }

How many steps are on the undo stack.

Type int

Methods in detail

Clear()

public void Clear();

Forgets both stacks. The hosted service does this once the application is up, so wiring does not end up as the first undo step.

Dispose()

public void Dispose();

Stops collecting edits.

Group()

public IDisposable Group();

Collects everything written until the scope is disposed into a single undo step. A group opened inside another joins it rather than closing it early.

Returns IDisposable — The scope to dispose when the group is complete.

Redo()

public bool Redo();

Applies an undone step again. Writing something new drops this branch.

Returns boolfalse when there was nothing to redo.

Undo()

public bool Undo();

Takes back the last step. Undoing does not itself become a step.

Returns boolfalse when there was nothing to undo.