Renderer.createFoldAtBufferRow uses the fold suggester to determine which syntactic region to fold

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-05-30 16:02:06 -06:00
parent 84318277ba
commit 63a87fd83e
2 changed files with 25 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ class Renderer
constructor: (@buffer, options={}) ->
@id = @constructor.idCounter++
@highlighter = new Highlighter(@buffer, options.tabText ? ' ')
@foldSuggester = new FoldSuggester(@buffer)
@foldSuggester = new FoldSuggester(@highlighter)
@maxLineLength = options.maxLineLength ? Infinity
@activeFolds = {}
@foldsById = {}
@@ -53,6 +53,10 @@ class Renderer
bufferRowsForScreenRows: (startRow, endRow) ->
@lineMap.bufferRowsForScreenRows(startRow, endRow)
createFoldAtBufferRow: (bufferRow) ->
[startRow, endRow] = @foldSuggester.rowRangeForFoldAtBufferRow(bufferRow)
@createFold(startRow, endRow)
createFold: (startRow, endRow) ->
fold = new Fold(this, startRow, endRow)
@registerFold(fold)