Exemplo n.º 1
0
        public override ActionResults Undo(out Pos pos)
        {
            pos = undoPos;

            if (deleteString != null)
            {
                pos = InsertRangeCommand.InsertRange(Document, undoPos, deleteString);
            }
            else if (deleteChar == Character.NewLine)
            {
                pos = new Pos(undoPos.Line, undoPos.Col);
                var txt = DeleteRangeCommand.DeleteRange(Ed, new Selection(pos,
                                                                           new Pos(pos.Line, Document.Lines[pos.Line].Length)));
                var ipos = InsertNewLineCommand.InsertNewLine(Document, pos);

                if (txt != null)
                {
                    Document.Lines[ipos.Line].Append(txt);
                }

                pos = ipos;
            }
            else
            {
                var ln = Document.Lines[undoPos.Line];
                ln.Insert(undoPos.Col, deleteChar);
                pos = new Pos(undoPos.Line, undoPos.Col + 1);
            }

            return(Change);
        }
Exemplo n.º 2
0
        public override ActionResults Undo(out Pos pos)
        {
            pos = undoPos;

            if (deleteString != null)
            {
                pos = InsertRangeCommand.InsertRange(Document, undoPos, deleteString);
            }
            else if (deleteChar == Character.NewLine)
            {
                InsertNewLineCommand.InsertNewLine(Document, undoPos);
            }
            else
            {
                var ln = Document.Lines[undoPos.Line];
                ln.Insert(undoPos.Col, deleteChar);
            }

            return(Change);
        }