updated Composition (error when doing undo)

This commit is contained in:
Kevin Jahns 2015-04-28 14:57:37 +02:00
parent 80f1cfd21b
commit 85d85540e7
2 changed files with 25 additions and 35 deletions

View File

@ -404,28 +404,22 @@ module.exports = function() {
if (op.uid.creator === this.tmp_composition_ref.creator && op.uid.op_number === this.tmp_composition_ref.op_number) { if (op.uid.creator === this.tmp_composition_ref.creator && op.uid.op_number === this.tmp_composition_ref.op_number) {
this.composition_ref = op; this.composition_ref = op;
delete this.tmp_composition_ref; delete this.tmp_composition_ref;
o = op.next_cl; op = op.next_cl;
while (o.next_cl != null) { if (op === this.end) {
if (!o.isDeleted()) { return;
this.callOperationSpecificInsertEvents(o);
}
o = o.next_cl;
} }
} else {
return;
} }
return;
} }
if (this.composition_ref.next_cl === op) { o = this.end.prev_cl;
op.undo_delta = this.getCustomType()._apply(op.val()); while (o !== op) {
} else { this.getCustomType()._unapply(o.undo_delta);
o = this.end.prev_cl; o = o.prev_cl;
while (o !== op) { }
this.getCustomType()._unapply(o.undo_delta); while (o !== this.end) {
o = o.prev_cl; o.undo_delta = this.getCustomType()._apply(o.val());
} o = o.next_cl;
while (o !== this.end) {
o.undo_delta = this.getCustomType()._apply(o.val());
o = o.next_cl;
}
} }
this.composition_ref = this.end.prev_cl; this.composition_ref = this.end.prev_cl;
return this.callEvent([ return this.callEvent([

View File

@ -354,23 +354,19 @@ module.exports = ()->
if op.uid.creator is @tmp_composition_ref.creator and op.uid.op_number is @tmp_composition_ref.op_number if op.uid.creator is @tmp_composition_ref.creator and op.uid.op_number is @tmp_composition_ref.op_number
@composition_ref = op @composition_ref = op
delete @tmp_composition_ref delete @tmp_composition_ref
o = op.next_cl op = op.next_cl
while o.next_cl? if op is @end
if not o.isDeleted() return
@callOperationSpecificInsertEvents o else
o = o.next_cl return
return
if @composition_ref.next_cl is op o = @end.prev_cl
op.undo_delta = @getCustomType()._apply op.val() while o isnt op
else @getCustomType()._unapply o.undo_delta
o = @end.prev_cl o = o.prev_cl
while o isnt op while o isnt @end
@getCustomType()._unapply o.undo_delta o.undo_delta = @getCustomType()._apply o.val()
o = o.prev_cl o = o.next_cl
while o isnt @end
o.undo_delta = @getCustomType()._apply o.val()
o = o.next_cl
@composition_ref = @end.prev_cl @composition_ref = @end.prev_cl
@callEvent [ @callEvent [