Folds include their first line

This commit is contained in:
Corey Johnson
2012-05-30 16:55:15 -07:00
parent 42e743f44a
commit 17b50ee8dc
5 changed files with 20 additions and 31 deletions

View File

@@ -12,6 +12,6 @@ class FoldSuggester
rowRangeForFoldAtBufferRow: (bufferRow) ->
if aceRange = @aceFoldMode?.getFoldWidgetRange(@aceFoldAdaptor, null, bufferRow)
[aceRange.start.row + 1, aceRange.end.row]
[aceRange.start.row, aceRange.end.row]
else
null

View File

@@ -54,21 +54,16 @@ class Renderer
@lineMap.bufferRowsForScreenRows(startRow, endRow)
toggleFoldAtBufferRow: (bufferRow) ->
if fold = @largestFoldForBufferRow(bufferRow)
fold.destroy()
else
rowToFold = bufferRow
while rowToFold >= 0
rowRange = @foldSuggester.rowRangeForFoldAtBufferRow(rowToFold)
if rowRange and (rowRange[0] - 1) <= bufferRow <= rowRange[1]
if fold = @largestFoldForBufferRow(rowRange[0])
fold.destroy()
else
@createFold(rowRange...)
for currentRow in [bufferRow..0]
[startRow, endRow] = @foldSuggester.rowRangeForFoldAtBufferRow(currentRow) ? []
continue unless startRow and startRow <= bufferRow <= endRow
return
else
rowToFold--
if fold = @largestFoldForBufferRow(startRow)
fold.destroy()
else
@createFold(startRow, endRow)
break
createFold: (startRow, endRow) ->
fold = new Fold(this, startRow, endRow)