 class IncrementNumber extends Operator
   @extend()
   displayName: 'Increment ++'
+  baseNumber: null
   step: 1
-  baseNumber: null
-
-  execute: ->
-    pattern = ///#{settings.get('numberRegex')}///g
+
+  execute: ->
     newRanges = null
+    @pattern ?= ///#{settings.get('numberRegex')}///g
 
     @startMutation =>
-      @selectTarget()
-      newRanges = for selection in @editor.getSelectionsOrderedByBufferPosition()
-        @replaceNumber(selection.getBufferRange(), pattern)
-
-    if (newRanges = _.flatten(newRanges)).length
-      @flashIfNecessary(newRanges)
-    else
-      atom.beep()
+      if @selectTarget()
+        selections = @editor.getSelectionsOrderedByBufferPosition()
+        newRanges = (@replaceNumber(selection) for selection in selections)
+
+    if (@newRanges = _.flatten(newRanges)).length
+      if settings.get('flashOnOperate') and (@getName() not in settings.get('flashOnOperateBlacklist'))
+        @vimState.flash(@newRanges, type: @flashTypeForOccurrence)
+
     for selection in @editor.getSelections()
       selection.cursor.setBufferPosition(selection.getBufferRange().start)
     @activateModeIfNecessary('normal')
 
-  replaceNumber: (scanRange, pattern) ->
+  replaceNumber: (selection) ->
+    scanRange = selection.getBufferRange()
     newRanges = []
-    @editor.scanInBufferRange pattern, scanRange, ({matchText, replace}) =>
-      newRanges.push replace(@getNewText(matchText))
+    @editor.scanInBufferRange @pattern, scanRange, ({matchText, replace}) =>
+      newRanges.push(replace(@getNextNumber(matchText)))
     newRanges
 
-  getNewText: (text) ->
-    @baseNumber = if @baseNumber?
-      @baseNumber + @step * @getCount()
-    else
-      parseInt(text, 10)
+  getNextNumber: (text) ->
+    if @baseNumber?
+      @baseNumber += @step * @getCount()
+    else
+      @baseNumber = parseInt(text, 10)
     String(@baseNumber)
 
 class DecrementNumber extends IncrementNumber

    number = parseInt(numberString, 10) + @step * @getCount()
    String(number)

class Decrease extends Increase
  @extend()
  step: -1

    newRange = null
    @editor.scanInBufferRange @pattern, scanRange, ({matchText, range, stop, replace}) =>
      if @target.is('CurrentSelection')
        @newRanges.push(replace(@getNextNumber(matchText)))
      else if range.end.isGreaterThan(initialPoint)
        newRange = replace(@getNextNumber(matchText))
        stop()
