Merge pull request #9468 from atom/as-faster-unfold-all

Make LanguageMode::unfoldAll faster
This commit is contained in:
Antonio Scandurra
2015-11-06 17:44:33 +01:00
2 changed files with 6 additions and 2 deletions

View File

@@ -465,6 +465,10 @@ class DisplayBuffer extends Model
folds
# Returns all the folds that intersect the given row range.
foldsIntersectingBufferRowRange: (startRow, endRow) ->
@foldForMarker(marker) for marker in @findFoldMarkers(intersectsRowRange: [startRow, endRow])
# Public: Given a buffer row, this returns folds that include it.
#
#

View File

@@ -97,8 +97,8 @@ class LanguageMode
# Unfolds all the foldable lines in the buffer.
unfoldAll: ->
for row in [@buffer.getLastRow()..0] by -1
fold.destroy() for fold in @editor.displayBuffer.foldsStartingAtBufferRow(row)
for fold in @editor.displayBuffer.foldsIntersectingBufferRowRange(0, @buffer.getLastRow()) by -1
fold.destroy()
return
# Fold all comment and code blocks at a given indentLevel