   subscribe: (args...) ->
     @subscriptions.add args...
 
+  composeOperation: (operation) ->
+    {mode} = @vimState
+    switch
+      when operation.isOperator()
+        if (mode is 'visual')
+          operation = operation.setTarget(@currentSelection)
+      when operation.isTextObject()
+        if (mode in ['visual', 'normal'])
+          operation = @select.setTarget(operation)
+      when operation.isMotion()
+        if (mode is 'visual')
+          operation = @select.setTarget(operation)
+    operation
+
   run: (klass, properties) ->
     klass = Base.getClass(klass) if _.isString(klass)
     try

      @finish()

  cancel: ->
    unless @vimState.isMode('visual') or @vimState.isMode('insert')
      @vimState.activate('reset')
    @finish()


      if (@peekTop()?.constructor is klass)
        klass = Base.getClass('MoveToRelativeLine')

      @stack.push @composeOperation(new klass(@vimState, properties))
      @processing = true
      @process()
    catch error
