Ensure we don't try to draw a destroyed selection on editor refresh

Destroying the cursor will cause a redraw, which causes a problem when
we execute it synchronously in specs because destroying the cursor also
destroys the marker associated with the selection. Here we remove the
selection first to avoid this problem.
This commit is contained in:
Nathan Sobo
2013-02-02 15:10:01 -07:00
parent 3d8406f5a3
commit 4a191586db

View File

@@ -20,11 +20,11 @@ class Selection
@destroy()
destroy: ->
if @cursor
@cursor.off('.selection')
@cursor.destroy()
return if @destroyed
@destroyed = true
@editSession.removeSelection(this)
@trigger 'destroyed'
@cursor?.destroy()
finalize: ->
@initialScreenRange = null unless @initialScreenRange?.isEqual(@getScreenRange())