Use DisplayLayer.prototype.foldBufferRange in Selection.prototype.fold

This commit is contained in:
Antonio Scandurra
2016-03-18 11:33:29 +01:00
parent 83da3ca440
commit d86309e46b
2 changed files with 5 additions and 2 deletions

View File

@@ -628,8 +628,8 @@ class Selection extends Model
# Public: Creates a fold containing the current selection.
fold: ->
range = @getBufferRange()
@editor.foldBufferRowRange(range.start.row, range.end.row)
@cursor.setBufferPosition([range.end.row + 1, 0])
@editor.foldBufferRange(range)
@cursor.setBufferPosition(range.end)
# Private: Increase the indentation level of the given text by given number
# of levels. Leaves the first line unchanged.

View File

@@ -3009,6 +3009,9 @@ class TextEditor extends Model
foldBufferRowRange: (startRow, endRow) ->
@displayBuffer.foldBufferRowRange(startRow, endRow)
foldBufferRange: (range) ->
@displayLayer.foldBufferRange(range)
# Remove any {Fold}s found that intersect the given buffer range.
destroyFoldsIntersectingBufferRange: (bufferRange) ->
@displayLayer.destroyFoldsIntersectingBufferRange(bufferRange)