Buffer changes updates a stable list of folds

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-05-25 10:58:30 -07:00
parent f8c3d89e60
commit 35b2f0e8c7
4 changed files with 44 additions and 28 deletions

View File

@@ -127,9 +127,9 @@ class Renderer
@lineMap.clipScreenPosition(position, options)
handleBufferChange: (e) ->
for row, folds of @activeFolds
for fold in new Array(folds...)
fold.handleBufferChange(e)
allFolds = [] # Folds can modify @activeFolds, so first make sure we have a stable array of folds
allFolds.push(folds...) for row, folds of @activeFolds
fold.handleBufferChange(e) for fold in allFolds
@handleHighlighterChange(@lastHighlighterChangeEvent)

View File

@@ -145,6 +145,7 @@ class Selection extends View
@editor.getCurrentMode().autoOutdent(state, new AceOutdentAdaptor(@editor.buffer, @editor), bufferRow)
backspace: ->
@editor.destroyFoldsContainingBufferRow(@getBufferRange().end.row)
@selectLeft() if @isEmpty()
@deleteSelectedText()