         @updateCursorElement()
       , 600
 
+
   addCursorElement: (content) ->
-    return content if not @visible
+
+    return content  unless @visible
+
     newContent = content.substring 0, @x
     newContent.merge = false
     @element = content.substring(@x, @x + 1).get(0) ? new StyledText(" ", @terminal.currentStyle)

    newContent

  updateCursorElement: ->
    return if not @element?
    @element.style.outlined = not @focused
    @element.style.inverse = @focused and @inversed
    @element.updateNode()





module.exports = class Cursor

  constructor: (terminal) ->

    @terminal      = terminal
    @element       = null

    @x             = 0
    @y             = 0
    @savedX        = 0
    @savedY        = 0

    @inversed      = yes
    @visible       = yes
    @focused       = yes

    @blinkInterval = null
    @resetBlink()


  move: (x, y) ->
    @moveTo @x + x, @y + y


  moveTo: (x, y) ->
    x = Math.max x, 0
