mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Remove toggleFold and replace with fold
This commit is contained in:
@@ -65,15 +65,14 @@ class DisplayBuffer
|
||||
|
||||
return
|
||||
|
||||
unfoldScopeContainingBufferRow: (bufferRow) ->
|
||||
for currentRow in [bufferRow..0]
|
||||
[startRow, endRow] = @tokenizedBuffer.rowRangeForFoldAtBufferRow(currentRow) ? []
|
||||
continue unless startRow? and startRow <= bufferRow <= endRow
|
||||
fold = @largestFoldStartingAtBufferRow(startRow)
|
||||
fold.destroy() if fold
|
||||
|
||||
isFoldContainedByActiveFold: (fold) ->
|
||||
for row, folds of @activeFolds
|
||||
for otherFold in folds
|
||||
return otherFold if fold != otherFold and fold.isContainedByFold(otherFold)
|
||||
|
||||
foldFor: (startRow, endRow) ->
|
||||
_.find @activeFolds[startRow] ? [], (fold) ->
|
||||
fold.startRow == startRow and fold.endRow == endRow
|
||||
return
|
||||
|
||||
createFold: (startRow, endRow) ->
|
||||
return fold if fold = @foldFor(startRow, endRow)
|
||||
@@ -92,6 +91,15 @@ class DisplayBuffer
|
||||
|
||||
fold
|
||||
|
||||
isFoldContainedByActiveFold: (fold) ->
|
||||
for row, folds of @activeFolds
|
||||
for otherFold in folds
|
||||
return otherFold if fold != otherFold and fold.isContainedByFold(otherFold)
|
||||
|
||||
foldFor: (startRow, endRow) ->
|
||||
_.find @activeFolds[startRow] ? [], (fold) ->
|
||||
fold.startRow == startRow and fold.endRow == endRow
|
||||
|
||||
destroyFold: (fold) ->
|
||||
@unregisterFold(fold.startRow, fold)
|
||||
|
||||
|
||||
@@ -200,7 +200,10 @@ class EditSession
|
||||
|
||||
fold: ->
|
||||
bufferRow = @bufferPositionForScreenPosition(@getCursorScreenPosition()).row
|
||||
@foldAtBufferRow(bufferRow)
|
||||
@foldScopeContainingBufferRow(bufferRow)
|
||||
|
||||
foldScopeContainingBufferRow: (bufferRow) ->
|
||||
@displayBuffer.foldScopeContainingBufferRow(bufferRow)
|
||||
|
||||
foldSelection: ->
|
||||
selection.fold() for selection in @getSelections()
|
||||
|
||||
Reference in New Issue
Block a user