     selectLeft: -> @selection.selectLeft()
     selectUp: -> @selection.selectUp()
     selectDown: -> @selection.selectDown()
-    selectToPosition: (position) -> @selection.selectToPosition(position)
+    selectToPosition: (position) ->
+      @selection.selectToPosition(position)
 
     insertText: (text) -> @selection.insertText(text)
     insertNewline: -> @selection.insertNewline()
-    backspace: -> @selection.backspace()
-    delete: -> @selection.delete()
     copySelection: -> @selection.copy()
 
+    deleteLeft: ->
+      @selectLeft() if @selection.isEmpty()
+      @selection.delete()
+
+    deleteRight: ->
+      @selectRight() if @selection.isEmpty()
+      @selection.delete()
+

        'shift-up': 'select-up'
        'shift-down': 'select-down'
        enter: 'newline'
        backspace: 'backspace'
        delete: 'delete'
        'meta-c': 'copy'

      @on 'move-right', => @moveCursorRight()

Point = require 'point'
Cursor = require 'cursor'
Selection = require 'selection'
Range = require 'range'
$ = require 'jquery'
$$ = require 'template/builder'
_ = require 'underscore'
