mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Replicate the destruction of selections
This commit is contained in:
@@ -25,6 +25,9 @@ describe "EditSession replication", ->
|
||||
editSession1.addCursorAtBufferPosition([5, 6])
|
||||
expect(editSession2.getSelectedBufferRanges()).toEqual editSession1.getSelectedBufferRanges()
|
||||
|
||||
editSession1.consolidateSelections()
|
||||
expect(editSession2.getSelectedBufferRanges()).toEqual editSession1.getSelectedBufferRanges()
|
||||
|
||||
it "replicates the scroll position", ->
|
||||
expect(editSession2.getScrollTop()).toBe editSession1.getScrollTop()
|
||||
expect(editSession2.getScrollLeft()).toBe editSession1.getScrollLeft()
|
||||
|
||||
@@ -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())
|
||||
|
||||
2
vendor/telepath
vendored
2
vendor/telepath
vendored
Submodule vendor/telepath updated: 6e4fb8c794...73dd98ba08
Reference in New Issue
Block a user