/** * Tell the edits in the given range (inclusive) to die, and * remove them from edits. from > to is a no-op. */ protected void TrimEdits(int from, int to) { if (from <= to) { for (int i = to; from <= i; i--) { IUndoableEdit e = edits[i]; e.Die(); edits.RemoveAt(i); } if (indexOfNextAdd > to) { indexOfNextAdd -= to - from + 1; } else if (indexOfNextAdd >= from) { indexOfNextAdd = from; } } }