_nextUndo should increment / decrement _before_ we _execute / _unexecute the action

previously we were doing the increment / decrement in the continuation,
but that is troublesome because _canUndo / _canRedo could return the
wrong value in the interim.