       @ctx.font = font
       @prevFont = font
 
+  renderCursor: ->
+    return unless @cursorOn and @cursorText
+
+    x = @cursorX * @cellWidth
+    y = @cursorY * @cellHeight
+
+    if @cursorVisible
+      @ctx.fillStyle = AsciiIo.colors[7]
+      @ctx.fillRect x, y, @cellWidth, @cellHeight
+      @ctx.fillStyle = AsciiIo.colors[0]
+      @ctx.fillText @cursorText, x, y + @cellHeight
+    else
+      @ctx.fillStyle = AsciiIo.colors[@cursorBrush.bgColor()]
+      @ctx.fillRect x, y, @cellWidth, @cellHeight
+      @ctx.fillStyle = AsciiIo.colors[@cursorBrush.fgColor()]
+      @ctx.fillText @cursorText, x, y + @cellHeight
+
+    console.log @cursorY
+    console.log @cursorVisible
+    console.log @cursorOn
+
   showCursor: (show) ->
-    # if show
-    #   @$el.addClass "cursor-on"
-    # else
-    #   @$el.removeClass "cursor-on"
+    @cursorOn = show
 
   blinkCursor: ->
-    # cursor = @$el.find(".cursor")
-    # if cursor.hasClass("visible")
-    #   cursor.removeClass "visible"
-    # else
-    #   cursor.addClass "visible"
+    @cursorVisible = !@cursorVisible
+    @renderCursor()
 
   resetCursorState: ->
-    # cursor = @$el.find(".cursor")
-    # cursor.addClass "visible"
+    @cursorVisible = true
+    @renderCursor()

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

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

      [text, brush] = fragment

      if cursorX isnt undefined and rendered <= cursorX < rendered + text.length
        @cursorBrush = brush
        @cursorText = text[cursorX - rendered]
        @cursorX = cursorX
        @cursorY = n

      @setBackgroundAttributes(brush)
      @ctx.fillRect left, top, text.length * @cellWidth, @cellHeight
