     wasVisual = @isMode('visual')
 
     if @needStay() and wasVisual
-      console.log 'case-1'
+      # console.log 'case-1'
       @cursorPositionManager.save('head', fromProperty: true, allowFallback: true) # visual-stay
 
     else if @needStay() and not wasVisual
-      console.log 'case-2'
+      # console.log 'case-2'
       @cursorPositionManager.save('head') unless @instanceof('Select') # stay
 
     else
-      console.log 'case-3'
+      # console.log 'case-3'
       @preemptDidSelectTarget =>
         @cursorPositionManager.save('start')
 

  mutateSelection: (selection) =>
    @setTextToRegisterForSelection(selection)
    selection.deleteSelectedText()


class DeleteRight extends Delete
  @extend()

    # we have to return to normal-mode from operator-pending or visual
    @activateMode('normal')

  capturePatternForOccurrence: ->
    @scanRangesForOccurrence = null

    if @isMode('visual')
      scanRanges = @editor.getSelectedBufferRanges()
      @vimState.modeManager.deactivate() # clear selection FIXME
      console.log 'deactivate on will-select-target'

      unless @isMode('visual', 'blockwise') # extend scanRange to include cursorWord
        # BUG dont extend if register value is specified
        range = getCurrentWordBufferRangeAndKind(@editor.getLastCursor()).range
        newRange = scanRanges.pop().union(range)
        scanRanges.push(newRange)
      @scanRangesForOccurrence = scanRanges
    @patternForOccurence ?= @getPatternForOccurrence()

  selectOccurrence: ->
    @scanRangesForOccurrence ?= @editor.getSelectedBufferRanges()
    ranges = scanInRanges(@editor, @patternForOccurence, @scanRangesForOccurrence)
    if ranges.length
      @editor.setSelectedBufferRanges(ranges)
    else
      # Restoring cursor position also clear selection
      # Unless clearing selection, we mutate original selection(e.g. paragraph) rather than occurrence.
      console.log "Fail to select occurrence"
      @restoreCursorPositions()
      return false

  # Return true unless all selection is empty.
  selectTarget: ->
    @saveCursorPositionsToRestore()
    @emitWillSelectTarget()
    if @isWithOccurrence()
      @capturePatternForOccurrence()
      @target.select()
      @selectOccurrence()
    else
      @target.select()

    @selectOccurrence() if @isWithOccurrence()
    @emitDidSelectTarget()
    @flashIfNecessary(@editor.getSelectedBufferRanges())
    @trackChangeIfNecessary()
