The method IEnumerable<IAction> SimpleHistory::EnumUndoableActions() exists.
Why is its pendant EnumRedoableActions() missing?
Is there a technical reason for this?
The use-case is: I've built Undo-Stack and Redo-Stack pop-up UI controls, so that the user can choose and perform (multiple) Undo & Redo actions via the mouse. Exactly like in Excel.
To fill the Redo-Stack pop-up control, I of course need EnumRedoableActions().
I have created this myself with the following code:
public IEnumerable<IAction> EnumRedoableActions()
SimpleHistoryNode current = Head;
while (CanMoveForward && current.NextNode != null)
current = current.NextNode;
while (current != null && current != CurrentState && current.PreviousAction != null)
yield return current.PreviousAction;
current = current.PreviousNode;
And it seems to work. Would you agree or have you any other comments?
Thanks in advance,