         start: value.length + start
         end: value.length + start
 
-    range = @getSelectionRange()
-    range.start = @editor.activeEditSession.indexForBufferPosition(start)
-    range.end = @editor.activeEditSession.indexForBufferPosition(end)
+    range = @editor.getSelection().getBufferRange()
+    range.start = Point.fromObject(@editSession.bufferPositionForIndex(start))
+    range.end = Point.fromObject(@editSession.bufferPositionForIndex(end))
 
-    # TODO: overwrite needs to happen here
+    @editor.setTextInRange(range, value)
 
-    @editor.insertText(value)
+    range.start = Point.fromObject(@editSession.bufferPositionForIndex(firstTabStop.start))
+    range.end = Point.fromObject(@editSession.bufferPositionForIndex(firstTabStop.end))
 
-    range.start = @editor.activeEditSession.indexForBufferPosition(firstTabStop.start)
-    range.end = @editor.activeEditSession.indexForBufferPosition(firstTabStop.end)
     @editor.getSelection().setBufferRange(range)
 
   # Returns the editor content.


  # Returns the currently selected text.
  getSelection: ->
    return @editor.activeEditSession.getSelectedText()

  # Returns the current editor's file path
  getFilePath: ->

  getSelectionRange: ->
    range = @editor.getSelection().getBufferRange()
    return {
      start: @editSession.indexForBufferPosition(range.start),
      end: @editSession.indexForBufferPosition(range.end)
    }

  # Creates a selection from the `start` to `end` character indexes.
