mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Honor preserveFolds option when creating a new selection
This commit is contained in:
@@ -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", ->
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user