 
       "\x0a": (data) -> @lineFeed()
 
-      "\x0d": (data) -> @cr()
+      "\x0d": (data) -> @carriageReturn()
 
       "\x0e": (data) ->
 


    "\x1b\\[>c": (data) -> # Secondary Device Attribute request (?)

    "\x1bP([^\\\\])*?\\\\": (data) -> # DCS, Device Control String

    "\x1bD": ->
      console.log 'ya yebie'

    "\x1bM": ->
      @reverseIndex()

    "\x1b\x37": (data) -> # save cursor pos and char attrs
      @saveCursor()

    "\x1b\x38": (data) -> # restore cursor pos and char attrs
      @restoreCursor()

  handleCSI: (term) ->
    switch term
      when "@"
        @reserveCharacters @n
      when "A"
        @cursorUp @n or 1
      when "B"
        @cursorDown @n or 1
      when "C"
        @cursorForward @n or 1
      when "D"
        @cursorBack @n or 1
      when "G"
        @setCursorColumn @n
      when "H"
        @setCursorPos @n or 1, @m or 1
      when "J"
        @eraseData @n or 0
      when "K"
        @eraseInLine @n or 0
      when "L"
        @insertLines @n or 1
      when "M"
        @deleteLines @n or 1
      when "d" # VPA - Vertical Position Absolute
        @setCursorLine(@n)
      when "l" # l, Reset mode
        console.log "(TODO) reset: " + @n
      when "m"
        @handleSGR @params
      when "P" # DCH - Delete Character, from current position to end of field
        @deleteCharacter @n or 1
      when "r" # Set top and bottom margins (scroll region on VT100)
        @setScrollRegion(@n, @m)
      else
        throw "no handler for CSI term: " + term


    @lineData = @alternateBuffer
    @updateScreen()

  updateLine: (n) ->
    n = (if typeof n isnt "undefined" then n else @cursorY)
    @dirtyLines[n] = n
