public void CloseGroup() { if (groupStart == null) { Debug.Assert(false); throw new InvalidOperationException(); } if (groupStart == records) { // delete empty undo group to eliminate no-op entries on user's undo stack records = records.Next; return; } if (clearRedo) { textEdit.redo = null; } SelectionUndoRecord selection = new SelectionUndoRecord(textEdit); selection.Next = records; records = selection; GroupEndUndoRecord end = new GroupEndUndoRecord(groupStart); end.Next = records; records = end; groupStart = null; }
public IDisposable OpenGroup() { // defer this until close group - avoids clearing redo if group was empty //if (clearRedo) //{ // textEdit.redo = null; //} if (groupStart == null) { groupStart = new GroupStartUndoRecord(); groupStart.Next = records; records = groupStart; return new UndoGroupCloser(this); } else { return null; } }
public GroupEndUndoRecord(GroupStartUndoRecord start) { this.Start = start; }