DisplayBuffer.destroyFoldsContainingBufferRow destroys all folds containing buffer row (instead of just folds starting at buffer row)

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-06-14 13:56:08 -07:00
parent b57eef6dbc
commit 8416dc3598
3 changed files with 18 additions and 6 deletions

View File

@@ -108,8 +108,9 @@ class DisplayBuffer
@trigger 'change', oldRange: oldScreenRange, newRange: newScreenRange, lineNumbersChanged: true
destroyFoldsContainingBufferRow: (bufferRow) ->
folds = @activeFolds[bufferRow] ? []
fold.destroy() for fold in new Array(folds...)
for row, folds of @activeFolds
for fold in new Array(folds...)
fold.destroy() if fold.getBufferRange().containsRow(bufferRow)
registerFold: (fold) ->
@activeFolds[fold.startRow] ?= []

View File

@@ -50,6 +50,9 @@ class Range
point = Point.fromObject(point)
point.isGreaterThanOrEqual(@start) and point.isLessThanOrEqual(@end)
containsRow: (row) ->
@start.row <= row <= @end.row
union: (otherRange) ->
start = if @start.isLessThan(otherRange.start) then @start else otherRange.start
end = if @end.isGreaterThan(otherRange.end) then @end else otherRange.end