message: fix bug in undo redo component
diff: @@ -154,24 +154,24 @@ interface IRevertable {
  class SequenceUndoRedo implements IRevertable {
  - private readonly tracking: ReadonlyArray<{ tg: TrackingGroup, pd: PropertySet }>;
  + private readonly tracking: Array<{ trackingGroup: TrackingGroup, propertyDelta: PropertySet }>;
  constructor(
  public readonly event: SequenceDeltaEvent,
  public readonly sequence: SharedSegmentSequence<ISegment>,
  ) {
  - const tracking = [];
  + const tracking: Array<{ trackingGroup: TrackingGroup, propertyDelta: PropertySet }> = [];
  if (event.ranges.length > 0) {
  - let current = { tg: new TrackingGroup(), pd: event.ranges[0].propertyDeltas };
  + let current = { trackingGroup: new TrackingGroup(), propertyDelta: event.ranges[0].propertyDeltas };
  tracking.push(current);
  - current.tg.link(event.ranges[0].segment);
  + current.trackingGroup.link(event.ranges[0].segment);
  for (let i = 1; i < event.ranges.length; i++) {
  - if (matchProperties(current.pd, event.ranges[i].propertyDeltas)) {
  - current.tg.link(event.ranges[i].segment);
  + if (matchProperties(current.propertyDelta, event.ranges[i].propertyDeltas)) {
  + current.trackingGroup.link(event.ranges[i].segment);
  } else {
  const tg = new TrackingGroup();
  tg.link(event.ranges[i].segment);
  - current = { tg, pd: event.ranges[i].propertyDeltas };
  + current = { trackingGroup: tg, propertyDelta: event.ranges[i].propertyDeltas };
  tracking.push(current);
  }
  }
  @@ -182,8 +182,11 @@ class SequenceUndoRedo implements IRevertable {
  public revert() {
  const mergeTree = this.sequence.client.mergeTree;
  const ops: IMergeTreeOp[] = [];
  - this.tracking.forEach((tracked) => tracked.tg.segments.forEach((sg) => {
  - sg.trackingCollection.unlink(tracked.tg);
  +
  + this.tracking.forEach((tracked) => {
  + while (tracked.trackingGroup.size > 0) {
  + const sg = tracked.trackingGroup.segments[0];
  + sg.trackingCollection.unlink(tracked.trackingGroup);
  switch (this.event.deltaOperation) {
  case MergeTreeDeltaType.INSERT:
  if (!sg.removedSeq) {
  @@ -224,7 +227,7 @@ class SequenceUndoRedo implements IRevertable {
  this.sequence.client.annotateRangeLocal(
  start,
  start + sg.cachedLength,
  - tracked.pd,
  + tracked.propertyDelta,
  undefined);
  if (annnotateOp) {
  ops.push(annnotateOp);
  @@ -232,15 +235,17 @@ class SequenceUndoRedo implements IRevertable {
  }
  break;
  }
  - }));
  + }
  + });
  +
  if (ops.length > 0) {
  this.sequence.submitSequenceMessage(createGroupOp(...ops));
  }
  }
  public disgard() {
  - this.tracking.forEach((tracked) => tracked.tg.segments.forEach(
  - (sg) => sg.trackingCollection.unlink(tracked.tg)));
  + this.tracking.forEach((tracked) => tracked.trackingGroup.segments.forEach(
  + (sg) => sg.trackingCollection.unlink(tracked.trackingGroup)));
  }
  }
  