 # Refactoring status: 100%
 _ = require 'underscore-plus'
+
 {CurrentSelection} = require './motion'
 {Select} = require './operator'
 {debug} = require './utils'
 settings = require './settings'
 
-module.exports =
 class OperationStack
   constructor: (@vimState) ->
     @stack = []
+    {@editor} = @vimState
 
   push: (op) ->
     if @isEmpty() and settings.get('debug')


  inspect: ->
    @vimState.developer?.inspectOperationStack()

        else
          throw error

    if @peekTop().isComplete()
      @inspect()
      debug '-> @pop()'
      op = @pop()
      debug " -> <#{op.getKind()}>.execute()"
      op.execute()

      @vimState.recordOperation(op) if op.isRecordable()
      @finish()
      debug "#=== Finish at #{new Date().toISOString()}\n"
    else
      if @vimState.isMode('normal') and @peekTop().isOperator?()
        @inspect()
        debug '-> @process(): activating: operator-pending-mode'
