       state.overwrittenBySelection = null
 
     unless state.overwrittenBySelection?
-      state.overwrittenBySelection = @getOverwrittenBySelection()
+      state.overwrittenBySelection = @getInitialOverwrittenBySelection()
 
     fn()
 

_ = require 'underscore-plus'
{CompositeDisposable} = require 'atom'
{inspect} = require 'util'

requireFrom = (pack, path) ->
  packPath = atom.packages.resolvePackagePath(pack)


  # Return [rotatedText, overwrittenText]
  rotateText: (text, selection, considerOverwrite=false) ->
    # up and down is only for linewise
    # left and right is only for characterwise
    switch @direction
      when 'up', 'left'
        [overwritten, rest...] = text
        overwritten = @getOverwrittenForSelection(selection, overwritten) if considerOverwrite
        [rest..., overwritten]
      when 'down', 'right'
        [rest..., overwritten] = text
        overwritten = @getOverwrittenForSelection(selection, overwritten) if considerOverwrite
        [overwritten, rest...]

class MoveSelectedTextUp extends MoveSelectedText
  direction: 'up'
  flashTarget: false

  moveLinewise: (selection) ->
    if @vimState.submode is 'linewise'
      @rotateTextForSelection(selection)
    else
      swrap(selection).switchToLinewise =>
        @rotateTextForSelection(selection)
    @editor.scrollToCursorPosition({center: true})

  moveCharacterwise: (selection) ->
    reversed = selection.isReversed()
    # Pre mutate
