diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index ca9be2a81..95fa44f10 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -755,8 +755,10 @@ describe "EditSession", -> it "does not remove folds that contain the selections", -> editSession.setSelectedBufferRange([[0,0], [0,0]]) editSession.createFold(1, 4) - editSession.setSelectedBufferRanges([[[2, 2], [3, 3]]], preserveFolds: true) - expect(editSession.lineForScreenRow(1).fold).toBeDefined() + editSession.createFold(6, 8) + editSession.setSelectedBufferRanges([[[2, 2], [3, 3]], [[6, 0], [6, 1]]], preserveFolds: true) + expect(editSession.isFoldedAtBufferRow(1)).toBeTruthy() + expect(editSession.isFoldedAtBufferRow(6)).toBeTruthy() describe ".selectMarker(marker)", -> describe "if the marker is valid", -> diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index 1ee261280..b5513037f 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -875,7 +875,7 @@ class EditSession # # Returns the new {Selection}. addSelection: (marker, options={}) -> - unless options.preserveFolds + unless marker.getAttributes().preserveFolds @destroyFoldsIntersectingBufferRange(marker.getBufferRange()) cursor = @addCursor(marker) selection = new Selection(_.extend({editSession: this, marker, cursor}, options))