mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
When updating folds, don't modify the array over which we're iterating
This commit is contained in:
@@ -464,6 +464,18 @@ describe "Renderer", ->
|
||||
expect(event.oldRange).toEqual [[4, 0], [4, 56]]
|
||||
expect(event.newRange).toEqual [[4, 0], [4, 60]]
|
||||
|
||||
describe "when the old range surrounds two nested folds", ->
|
||||
it "removes both folds and replaces the fold placeholder with the new text", ->
|
||||
renderer.createFold([[4, 25], [7, 5]])
|
||||
buffer.change([[4, 25], [7, 5]], '4)')
|
||||
|
||||
expect(renderer.lineForRow(4).text).toBe ' while(items.length > 4)...concat(sort(right));'
|
||||
# expect(changeHandler).toHaveBeenCalled()
|
||||
# [[event]] = changeHandler.argsForCall
|
||||
# expect(event.oldRange).toEqual [[4, 0], [4, 56]]
|
||||
# expect(event.newRange).toEqual [[4, 0], [4, 60]]
|
||||
|
||||
|
||||
describe "position translation", ->
|
||||
describe "when there is single fold spanning multiple lines", ->
|
||||
it "translates positions to account for folded lines and characters and the placeholder", ->
|
||||
|
||||
@@ -117,7 +117,7 @@ class Renderer
|
||||
|
||||
handleBufferChange: (e) ->
|
||||
for row, folds of @activeFolds
|
||||
for fold in folds
|
||||
for fold in new Array(folds...)
|
||||
changeInsideFold = true if fold.handleBufferChange(e)
|
||||
|
||||
unless changeInsideFold
|
||||
|
||||
Reference in New Issue
Block a user