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