🐎 Make LanguageMode::unfoldAll faster

This commit is contained in:
Antonio Scandurra
2015-11-06 13:08:36 +01:00
parent 5ed9610afc
commit dd10216943
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 contain the given row range.
foldsContainingBufferRowRange: (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.foldsContainingBufferRowRange(0, @buffer.getLastRow()) by -1
fold.destroy()
return
# Fold all comment and code blocks at a given indentLevel