Make outermostFoldsForBufferRowRange exclusive of end row

This commit is contained in:
Nathan Sobo
2014-03-06 12:52:27 -07:00
parent 66f6e38788
commit ce4ce55b29
2 changed files with 4 additions and 4 deletions

View File

@@ -526,15 +526,15 @@ describe "DisplayBuffer", ->
expect(displayBuffer.lineForRow(10).fold).toBeDefined()
describe ".outermostFoldsInBufferRowRange(startRow, endRow)", ->
it "returns the outermost folds entirely contained in the given row range, inclusive of end row", ->
it "returns the outermost folds entirely contained in the given row range, exclusive of end row", ->
fold1 = displayBuffer.createFold(4, 7)
fold2 = displayBuffer.createFold(5, 6)
fold3 = displayBuffer.createFold(11, 15)
fold4 = displayBuffer.createFold(12, 13)
fold5 = displayBuffer.createFold(16, 17)
expect(displayBuffer.outermostFoldsInBufferRowRange(3, 17)).toEqual [fold1, fold3, fold5]
expect(displayBuffer.outermostFoldsInBufferRowRange(5, 15)).toEqual [fold3]
expect(displayBuffer.outermostFoldsInBufferRowRange(3, 18)).toEqual [fold1, fold3, fold5]
expect(displayBuffer.outermostFoldsInBufferRowRange(5, 16)).toEqual [fold3]
describe ".clipScreenPosition(screenPosition, wrapBeyondNewlines: false, wrapAtSoftNewlines: false, skipAtomicTokens: false)", ->
beforeEach ->

View File

@@ -216,7 +216,7 @@ class DisplayBuffer extends Model
@foldsContainingBufferRow(bufferRow)[0]
outermostFoldsInBufferRowRange: (startRow, endRow) ->
@findFoldMarkers(containedInRange: [[startRow, 0], [endRow + 1, 0]])
@findFoldMarkers(containedInRange: [[startRow, 0], [endRow, 0]])
.map (marker) => @foldForMarker(marker)
.filter (fold) -> not fold.isInsideLargerFold()