add getAllFolds

This commit is contained in:
Fabian Jakobs 2011-12-02 13:19:42 +01:00
commit 829c24c780

View file

@ -113,6 +113,29 @@ function Folding() {
}
return foundFolds;
};
/**
* Returns all folds in the document
*/
this.getAllFolds = function() {
var folds = [];
var foldLines = this.$foldData;
function addFold(fold) {
folds.push(fold);
if (!fold.subFolds)
return;
for (var i = 0; i < fold.subFolds.length; i++)
addFold(fold.subFolds[i]);
}
for (var i = 0; i < foldLines.length; i++)
for (var j = 0; j < foldLines[i].folds.length; j++)
addFold(foldLines[i].folds[j]);
return folds;
};
/**
* Returns the string between folds at the given position.