mirror of
https://github.com/atom/atom.git
synced 2026-02-19 02:44:29 -05:00
Replicate the destruction of selections
This commit is contained in:
@@ -35,13 +35,14 @@ class Cursor
|
||||
|
||||
@trigger 'moved', movedEvent
|
||||
@editSession.trigger 'cursor-moved', movedEvent
|
||||
@marker.on 'destroyed', =>
|
||||
@destroyed = true
|
||||
@editSession.removeCursor(this)
|
||||
@trigger 'destroyed'
|
||||
@needsAutoscroll = true
|
||||
|
||||
destroy: ->
|
||||
@destroyed = true
|
||||
@marker.destroy()
|
||||
@editSession.removeCursor(this)
|
||||
@trigger 'destroyed'
|
||||
|
||||
changePosition: (options, fn) ->
|
||||
@goalColumn = null
|
||||
|
||||
@@ -18,16 +18,13 @@ class Selection
|
||||
constructor: ({@cursor, @marker, @editSession, @goalBufferRange}) ->
|
||||
@cursor.selection = this
|
||||
@marker.on 'changed', => @screenRangeChanged()
|
||||
@cursor.on 'destroyed.selection', =>
|
||||
@cursor = null
|
||||
@destroy()
|
||||
@marker.on 'destroyed', =>
|
||||
@destroyed = true
|
||||
@editSession.removeSelection(this)
|
||||
@trigger 'destroyed' unless @editSession.destroyed
|
||||
|
||||
destroy: ->
|
||||
return if @destroyed
|
||||
@destroyed = true
|
||||
@editSession.removeSelection(this)
|
||||
@trigger 'destroyed' unless @editSession.destroyed
|
||||
@cursor?.destroy()
|
||||
@marker.destroy()
|
||||
|
||||
finalize: ->
|
||||
@initialScreenRange = null unless @initialScreenRange?.isEqual(@getScreenRange())
|
||||
|
||||
Reference in New Issue
Block a user