mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add DisplayBuffer::outermostFoldsInBufferRowRange
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
"serializable": "1.x",
|
||||
"space-pen": "3.1.1",
|
||||
"temp": "0.5.0",
|
||||
"text-buffer": "^1.2.0",
|
||||
"text-buffer": "^1.3.0",
|
||||
"theorist": "1.x",
|
||||
"underscore-plus": ">=1.0.2 <2.0",
|
||||
"vm-compatibility-layer": "0.1.0"
|
||||
|
||||
@@ -525,6 +525,17 @@ describe "DisplayBuffer", ->
|
||||
expect(displayBuffer.lineForRow(8).text).toMatch /^9-+/
|
||||
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", ->
|
||||
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]
|
||||
|
||||
describe ".clipScreenPosition(screenPosition, wrapBeyondNewlines: false, wrapAtSoftNewlines: false, skipAtomicTokens: false)", ->
|
||||
beforeEach ->
|
||||
displayBuffer.setSoftWrap(true)
|
||||
|
||||
@@ -215,6 +215,11 @@ class DisplayBuffer extends Model
|
||||
largestFoldContainingBufferRow: (bufferRow) ->
|
||||
@foldsContainingBufferRow(bufferRow)[0]
|
||||
|
||||
outermostFoldsInBufferRowRange: (startRow, endRow) ->
|
||||
@findFoldMarkers(containedInRange: [[startRow, 0], [endRow + 1, 0]])
|
||||
.map (marker) => @foldForMarker(marker)
|
||||
.filter (fold) -> not fold.isInsideLargerFold()
|
||||
|
||||
# Public: Given a buffer row, this returns folds that include it.
|
||||
#
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user