do not throw when trying to add intersecting folds

This commit is contained in:
nightwing 2014-10-05 22:05:34 +04:00
commit 2983c4b19f

View file

@ -289,12 +289,11 @@ function Folding() {
if (startFold && endFold == startFold) if (startFold && endFold == startFold)
return startFold.addSubFold(fold); return startFold.addSubFold(fold);
if ( if (startFold && !startFold.range.isStart(startRow, startColumn))
(startFold && !startFold.range.isStart(startRow, startColumn)) this.removeFold(startFold);
|| (endFold && !endFold.range.isEnd(endRow, endColumn))
) { if (endFold && !endFold.range.isEnd(endRow, endColumn))
throw new Error("A fold can't intersect already existing fold" + fold.range + startFold.range); this.removeFold(endFold);
}
// Check if there are folds in the range we create the new fold for. // Check if there are folds in the range we create the new fold for.
var folds = this.getFoldsInRange(fold.range); var folds = this.getFoldsInRange(fold.range);