added support for getNext/getPrev on insertions

This commit is contained in:
DadaMonad 2015-04-07 10:37:50 +00:00
parent 6d99ed07f0
commit d9c5ab5fa8
11 changed files with 203 additions and 37 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -281,6 +281,28 @@ module.exports = function() {
}
};
Insert.prototype.getNext = function() {
var n;
n = this.next_cl;
while (n.is_deleted && (n.next_cl != null)) {
n = n.next_cl;
}
return n;
};
Insert.prototype.getPrev = function() {
var n;
n((function(_this) {
return function() {
return _this.prev_cl;
};
})(this));
while (n.is_deleted && (n.prev_cl != null)) {
n = n.prev_cl;
}
return n;
};
Insert.prototype.applyDelete = function(o) {
var callLater, garbagecollect, _ref;
if (this.deleted_by == null) {

View File

@ -385,15 +385,15 @@ module.exports = function() {
Composition.prototype.callOperationSpecificInsertEvents = function(op) {
var o;
if (this.composition_ref.next_cl === op) {
o.undo_delta = this.custom_type._apply(op.content);
op.undo_delta = this.getCustomType()._apply(op.content);
} else {
o = this.end.prev_cl;
while (o !== op) {
this.custom_type._unapply(o.undo_delta);
this.getCustomType()._unapply(o.undo_delta);
o = o.next_cl;
}
while (o !== this.end) {
o.undo_delta = this.custom_type._apply(o.content);
o.undo_delta = this.getCustomType()._apply(o.content);
o = o.next_cl;
}
}
@ -410,7 +410,7 @@ module.exports = function() {
Composition.prototype.callOperationSpecificDeleteEvents = function(op, del_op) {};
Composition.prototype.applyDelta = function(delta) {
(new ops.Insert(null, content, this, null, this.end.prev_cl, this.end)).execute();
(new ops.Insert(null, delta, this, null, this.end.prev_cl, this.end)).execute();
return void 0;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -328,6 +328,18 @@ module.exports = ()->
else
@content
getNext: ()->
n = @next_cl
while n.is_deleted and n.next_cl?
n = n.next_cl
n
getPrev: ()->
n => @prev_cl
while n.is_deleted and n.prev_cl?
n = n.prev_cl
n
#
# set content to null and other stuff
# @private

File diff suppressed because one or more lines are too long

2
y.js

File diff suppressed because one or more lines are too long