diff --git a/spec/app/edit-session-replication-spec.coffee b/spec/app/edit-session-replication-spec.coffee index 198258e32..a84823b39 100644 --- a/spec/app/edit-session-replication-spec.coffee +++ b/spec/app/edit-session-replication-spec.coffee @@ -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() diff --git a/src/app/cursor.coffee b/src/app/cursor.coffee index 8261f74e1..fefc3f237 100644 --- a/src/app/cursor.coffee +++ b/src/app/cursor.coffee @@ -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 diff --git a/src/app/selection.coffee b/src/app/selection.coffee index d9c35b011..c47bec1fa 100644 --- a/src/app/selection.coffee +++ b/src/app/selection.coffee @@ -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()) diff --git a/vendor/telepath b/vendor/telepath index 6e4fb8c79..73dd98ba0 160000 --- a/vendor/telepath +++ b/vendor/telepath @@ -1 +1 @@ -Subproject commit 6e4fb8c7943ec5e6cc88bdbdf43bdd7d287d3799 +Subproject commit 73dd98ba087c2b1b59a6e67f3e2a4952f54c35ea