   restorePositions: false
   step: 1
 
-  mutateSelection: (selection) ->
-    initialPoint = @mutationManager.getInitialPointForSelection(selection)
-    @pattern ?= ///#{settings.get('numberRegex')}///g
-    scanRange = selection.getBufferRange()
-
-    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()
-
-    if @target.is('CurrentSelection')
-      point = scanRange.start
-    else
-      point = newRange?.end.translate([0, -1]) ? initialPoint
-    selection.cursor.setBufferPosition(point)
-
-  getNextNumber: (numberString) ->
-    number = parseInt(numberString, 10) + @step * @getCount()
-    String(number)
-
   execute: ->
     @newRanges = []
     super

      if settings.get('flashOnOperate') and (@getName() not in settings.get('flashOnOperateBlacklist'))
        @vimState.flash(@newRanges, type: @flashTypeForOccurrence)

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

# -------------------------
class IncrementNumber extends Operator
  @extend()
  displayName: 'Increment ++'
  baseNumber: null
  step: 1

  execute: ->
    newRanges = null
    @pattern ?= ///#{settings.get('numberRegex')}///g

    @startMutation =>
      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: (selection) ->
    scanRange = selection.getBufferRange()
    newRanges = []
    @editor.scanInBufferRange @pattern, scanRange, ({matchText, replace}) =>
      newRanges.push(replace(@getNextNumber(matchText)))
    newRanges

  getNextNumber: (text) ->
    if @baseNumber?
      @baseNumber += @step * @getCount()
    else
      @baseNumber = parseInt(text, 10)
    String(@baseNumber)

class DecrementNumber extends IncrementNumber
  @extend()

  execute: ->
    @startMutation =>
      if @selectTarget()
        if @mutateSelectionOrderd
          selections = @editor.getSelectionsOrderedByBufferPosition()
        else
          selections = @editor.getSelections()
        for selection in selections
          @mutateSelection(selection)
        @restoreCursorPositionsIfNecessary()

