       selections = @editor.getSelectionsOrderedByBufferPosition()
       topSelection = selections[0]
       selections.reverse() if @direction is 'down'
-      @initOverwrittenByEditor()
+      @initOverwrittenArea()
       @editor.transact =>
         @countTimes =>
           return if (not @isLinewise()) and (not @isMovable(topSelection))

swrap = requireFrom('vim-mode-plus', 'selection-wrapper')

CommandPrefix = 'vim-mode-plus-user'
stateByEditor = new Map
checkPointByEditor = new Map
disposableByEditor = new Map
overwrittenByEditor = new Map

# -------------------------
class MoveSelectedText extends TransformString

    atom.config.get('vim-mode-plus-move-selected-text.overwrite')

  withUndoJoin: (fn) ->
    stateByEditor.set(@editor, newState()) unless stateByEditor.has(@editor)

    unless disposableByEditor.has(@editor)
      disposable = @vimState.modeManager.onDidDeactivateMode ({mode}) =>
        if mode is 'visual'
          stateByEditor.delete(@editor)

      disposableByEditor.set @editor, @editor.onDidDestroy =>
        stateByEditor.delete(@editor)
        disposable.dispose()

    state = stateByEditor.get(@editor)
    isSequential = state.selectedTexts is @getSelectedTexts()
    unless isSequential
      state.checkpoint = @editor.createCheckpoint()
      state.overwritten = null

    fn()

    state.selectedTexts = @getSelectedTexts()
    if isSequential
      @editor.groupChangesSinceCheckpoint(state.checkpoint)

  getOverwrittenText: (replacedText) ->
    state = stateByEditor.get(@editor)
    overwrittenArea = state.overwritten[@selectionIndex]
    replacedText = switch @direction
      when 'up'
        [overwritten, rest...] = overwrittenArea.split("\n")
