Don't blink the cursor if it should not be visible

Also, when stopping blinking, set the cursor's visibility to whatever it is on the underlying model. This fixes issues where the cursor would blink when there was a selection.
This commit is contained in:
Nathan Sobo
2012-11-14 21:21:48 -07:00
parent 1acde4f534
commit e47cc1256d

View File

@@ -67,16 +67,16 @@ class CursorView extends View
@css('visibility', 'hidden')
toggleVisible: ->
@setVisible(not @visible) if @cursor.isVisible
@setVisible(not @visible)
stopBlinking: ->
clearInterval(@blinkInterval) if @blinkInterval
@blinkInterval = null
@setVisible(true) if @cursor.isVisible
@setVisible(@cursor.isVisible())
startBlinking: ->
return if @blinkInterval?
blink = => @toggleVisible()
blink = => @toggleVisible() if @cursor.isVisible()
@blinkInterval = setInterval(blink, @blinkPeriod / 2)
resetBlinking: ->