       [text, brush] = fragment
 
       if cursorX isnt undefined and rendered <= cursorX < rendered + text.length
-        cursorText = text[cursorX - rendered]
+        @cursorBrush = brush
+        @cursorText = text[cursorX - rendered]
+        @cursorX = cursorX
+        @cursorY = n
 
       @setBackgroundAttributes(brush)
       @ctx.fillRect left, top, text.length * @cellWidth, @cellHeight

      rendered += text.length

    if cursorX
      x = cursorX * @cellWidth
      @ctx.fillStyle = AsciiIo.colors[7]
      @ctx.fillRect x, top, @cellWidth, @cellHeight
      if cursorText
        @ctx.fillStyle = AsciiIo.colors[0]
        @ctx.fillText cursorText, x, top + @cellHeight

  setBackgroundAttributes: (brush) ->
    @ctx.fillStyle = AsciiIo.colors[brush.bgColor()]

  initialize: (options) ->
    super(options)
    @ctx = @el.getContext('2d')
    @cursorOn = true
    @cursorVisible = true

  afterInsertedToDom: ->
    sample = $('<span class="font-sample">M</span>')
