More work on Split. Update the demo UI on changes

This commit is contained in:
Julian Viereck 2011-05-20 22:51:16 +02:00
commit c38ddf3245
7 changed files with 210 additions and 18 deletions

View file

@ -58,7 +58,7 @@ function FoldLine(foldData, folds) {
this.end = this.range.end;
this.folds.forEach(function(fold) {
fold.foldLine = this;
fold.setFoldLine(this);
}, this);
}

View file

@ -59,6 +59,22 @@ Fold.prototype.toString = function() {
return '"' + this.placeholder + '" ' + this.range.toString();
}
Fold.prototype.setFoldLine = function(foldLine) {
this.foldLine = foldLine;
this.subFolds.forEach(function(fold) {
fold.setFoldLine(foldLine);
});
}
Fold.prototype.clone = function() {
var range = this.range.clone();
var fold = new Fold(range, this.placeholder);
this.subFolds.forEach(function(subFold) {
fold.subFolds.push(subFold.clone());
});
return fold;
}
function Folding() {
/**
* Looks up a fold at a given row/column. Possible values for side:
@ -526,6 +542,19 @@ function Folding() {
foldLine, row, endColumn, startRow, startColumn);
}
};
this.$cloneFoldData = function() {
var foldData = this.$foldData;
var fd = [];
fd = this.$foldData.map(function(foldLine) {
var folds = foldLine.folds.map(function(fold) {
return fold.clone();
});
return new FoldLine(fd, folds);
});
return fd;
};
}
exports.Folding = Folding;