From 85d85540e78c0ca8337efcfbd896e6164e1698c6 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Tue, 28 Apr 2015 14:57:37 +0200 Subject: [PATCH] updated Composition (error when doing undo) --- build/node/Operations/Structured.js | 32 ++++++++++++----------------- lib/Operations/Structured.coffee | 28 +++++++++++-------------- 2 files changed, 25 insertions(+), 35 deletions(-) diff --git a/build/node/Operations/Structured.js b/build/node/Operations/Structured.js index 05078713..f10b1abc 100644 --- a/build/node/Operations/Structured.js +++ b/build/node/Operations/Structured.js @@ -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) { this.composition_ref = op; delete this.tmp_composition_ref; - o = op.next_cl; - while (o.next_cl != null) { - if (!o.isDeleted()) { - this.callOperationSpecificInsertEvents(o); - } - o = o.next_cl; + op = op.next_cl; + if (op === this.end) { + return; } + } else { + return; } - return; } - if (this.composition_ref.next_cl === op) { - op.undo_delta = this.getCustomType()._apply(op.val()); - } else { - o = this.end.prev_cl; - while (o !== op) { - this.getCustomType()._unapply(o.undo_delta); - o = o.prev_cl; - } - while (o !== this.end) { - o.undo_delta = this.getCustomType()._apply(o.val()); - o = o.next_cl; - } + o = this.end.prev_cl; + while (o !== op) { + this.getCustomType()._unapply(o.undo_delta); + o = o.prev_cl; + } + while (o !== this.end) { + o.undo_delta = this.getCustomType()._apply(o.val()); + o = o.next_cl; } this.composition_ref = this.end.prev_cl; return this.callEvent([ diff --git a/lib/Operations/Structured.coffee b/lib/Operations/Structured.coffee index c4bd5160..aef70e04 100644 --- a/lib/Operations/Structured.coffee +++ b/lib/Operations/Structured.coffee @@ -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 @composition_ref = op delete @tmp_composition_ref - o = op.next_cl - while o.next_cl? - if not o.isDeleted() - @callOperationSpecificInsertEvents o - o = o.next_cl - return + op = op.next_cl + if op is @end + return + else + return - if @composition_ref.next_cl is op - op.undo_delta = @getCustomType()._apply op.val() - else - o = @end.prev_cl - while o isnt op - @getCustomType()._unapply o.undo_delta - o = o.prev_cl - while o isnt @end - o.undo_delta = @getCustomType()._apply o.val() - o = o.next_cl + o = @end.prev_cl + while o isnt op + @getCustomType()._unapply o.undo_delta + o = o.prev_cl + while o isnt @end + o.undo_delta = @getCustomType()._apply o.val() + o = o.next_cl @composition_ref = @end.prev_cl @callEvent [