mirror of
https://github.com/atom/atom.git
synced 2026-02-09 22:24:59 -05:00
Bugfix: When the command panel makes a selection, it destroys surrounding folds
This commit is contained in:
@@ -214,6 +214,10 @@ class EditSession
|
||||
destroyFoldsContainingBufferRow: (bufferRow) ->
|
||||
@displayBuffer.destroyFoldsContainingBufferRow(bufferRow)
|
||||
|
||||
destroyFoldsIntersectingBufferRange: (bufferRange) ->
|
||||
for row in [bufferRange.start.row..bufferRange.end.row]
|
||||
@destroyFoldsContainingBufferRow(row)
|
||||
|
||||
unfoldCurrentRow: ->
|
||||
@largestFoldStartingAtBufferRow(@getLastCursor().getBufferRow())?.destroy()
|
||||
|
||||
@@ -322,7 +326,9 @@ class EditSession
|
||||
@trigger 'add-selection', selection
|
||||
selection
|
||||
|
||||
addSelectionForBufferRange: (bufferRange, options) ->
|
||||
addSelectionForBufferRange: (bufferRange, options={}) ->
|
||||
bufferRange = Range.fromObject(bufferRange)
|
||||
@destroyFoldsIntersectingBufferRange(bufferRange) unless options.preserveFolds
|
||||
@addCursor().selection.setBufferRange(bufferRange, options)
|
||||
@mergeIntersectingSelections()
|
||||
|
||||
@@ -337,9 +343,6 @@ class EditSession
|
||||
|
||||
for bufferRange, i in bufferRanges
|
||||
bufferRange = Range.fromObject(bufferRange)
|
||||
unless options.preserveFolds
|
||||
for row in [bufferRange.start.row..bufferRange.end.row]
|
||||
@destroyFoldsContainingBufferRow(row)
|
||||
if selections[i]
|
||||
selections[i].setBufferRange(bufferRange, options)
|
||||
else
|
||||
|
||||
@@ -54,6 +54,7 @@ class Selection
|
||||
[start, end] = [end, start] if options.reverse
|
||||
|
||||
@modifyScreenRange =>
|
||||
@editSession.destroyFoldsIntersectingBufferRange(bufferRange) unless options.preserveFolds
|
||||
@placeAnchor() unless @anchor
|
||||
@modifySelection =>
|
||||
@anchor.setBufferPosition(start, options)
|
||||
|
||||
Reference in New Issue
Block a user