Exemplo n.º 1
0
            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;
            }
Exemplo n.º 2
0
            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;
                }
            }
Exemplo n.º 3
0
 public GroupEndUndoRecord(GroupStartUndoRecord start)
 {
     this.Start = start;
 }