       marker.destroy()
     , settings.get('flashOnOperateDurationMilliSeconds')
 
-  withFlashing: (callback) ->
-    unless settings.get('flashOnOperate')
-      callback()
-      return
-
-    markerBySelections = @markSelections()
-    callback()
-    for selection in @editor.getSelections()
-      @editor.decorateMarker markerBySelections[selection.id],
-        type: 'highlight'
-        class: 'vim-mode-flash'
-
-    # Ensure destroy all marker
-    setTimeout  ->
-      marker.destroy() for __, marker of markerBySelections
-    , settings.get('flashOnOperateDurationMilliSeconds')
-
-  selectTarget: (callback) ->
-    if @target.select()
-      callback()
-
-  selectTargetWithFlashing: (callback) ->
-    @selectTarget =>
-      @withFlashing ->
-        callback()
+  eachSelection: (fn) ->
+    return unless @target.select()
+    @editor.transact =>
+      for s in @editor.getSelections()
+        if @flashTarget and settings.get('flashOnOperate')
+          @flash s.getBufferRange(), -> fn(s)
+        else
+          fn(s)
 
 class Select extends Operator
   @extend()

class Indent extends Operator
  @extend()
  hoverText: ':point_right:'
  # hoverIcon: ':indent:'
  hoverIcon: ':indent:'
  execute: ->
    @target.select()
    startRow = @editor.getSelectedBufferRange().start.row
    @indent()
    @editor.setCursorBufferPosition([startRow, 0])
    @editor.moveToFirstCharacterOfLine()
    @vimState.activateNormalMode()

  indent: ->
    @editor.indentSelectedRows()

class Outdent extends Indent
  @extend()
  hoverText: ':point_left:'
  hoverIcon: ':outdent:'

  indent: ->
    @editor.outdentSelectedRows()

class AutoIndent extends Indent
  @extend()
  hoverText: ':open_hands:'
  hoverIcon: ':auto-indent:'
  indent: ->
    @editor.autoIndentSelectedRows()

# Put
# -------------------------


    @editor.transact =>
      if @target?
        if @target.select()
          @editor.replaceSelectedText null, (text) =>
            text.replace(/./g, @input)
          for selection in @editor.getSelections()
