               newText = selection.getText().repeat(@getCount())
               width = newText.length
               {start, end} = selection.getBufferRange()
-              switch @direction
+              range = switch @direction
                 when 'left'
-                  range = if @isOverwrite()
+                  if @isOverwrite()
                     [start.translate([0, -width]), start]
                   else
                     [start, start]
-                  range = @editor.setTextInBufferRange(range, newText)
-                  selection.setBufferRange(range)
-
                 when 'right'
-                  range = if @isOverwrite()
+                  if @isOverwrite()
                     [end, end.translate([0, +width])]
                   else
                     [end, end]
-                  range = @editor.setTextInBufferRange(range, newText)
-                  selection.setBufferRange(range)
+              @setTextInRangeAndSelect(range, newText, selection)
 
           when 'up', 'down'
             getBaseTexts = (blockwiseSelection) ->

    selections.forEach (selection) =>
      range = selection.getBufferRange().translate(translation)
      @complementSpacesToPoint(range.start)
      range = @editor.setTextInBufferRange(range, selection.getText())
      selection.setBufferRange(range)

  complementSpacesToPoint: ({row, column}) ->
    eol = @editor.bufferRangeForBufferRow(row).end
    if (fillCount = column - eol.column) > 0
      @editor.setTextInBufferRange([eol, eol], ' '.repeat(fillCount))

  insertTextAtPoint: (point, text) ->
    @editor.setTextInBufferRange([point, point], text)

  isLinewise: ->
    switch @vimState.submode

  flashTarget: false

  moveLinewise: (selection) ->
    switch @direction
      when 'right' then selection.indentSelectedRows()
      when 'left' then selection.outdentSelectedRows()
