Fix refreshing bug when doing undo/redo
Save selected node with action history

Because some actions are now unaltering and not stored in history, we
need to store the selected node at the time of an action's execution to
replay it correctly.