Bugfix: When the command panel makes a selection, it destroys surrounding folds

This commit is contained in:
Nathan Sobo
2012-07-26 10:09:28 -06:00
parent f2fa9793b1
commit 54616aee78
3 changed files with 20 additions and 4 deletions

View File

@@ -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

View File

@@ -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)