Example #1
0
        public override ActionResults Undo(out Pos pos)
        {
            pos = undoPos;

            if (@string != null)
            {
                pos = InsertRangeCommand.InsertRange(Document, undoPos, @string);
            }

            var line     = Document.Lines[pos.Line];
            var nextLine = Document.Lines[pos.Line + 1];

            Document.Lines.Remove(nextLine);

            if (indent > 0)
            {
                var real = Ed.UseTabs ? indent / Ed.IndentSize : indent;
                nextLine.RemoveRange(0, real);
            }

            if (unindent != null)
            {
                line.Insert(0, unindent);
            }

            line.Append(nextLine);
            return(Change);
        }
Example #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)
            {
                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);
        }
Example #3
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);
        }
Example #4
0
        public override ActionResults Undo(out Pos pos)
        {
            var lines = Document.Lines;

            lines[undoPos.Line].RemoveAt(undoPos.Col);
            pos = Pos.Empty;

            if (insertString != null)
            {
                pos = InsertRangeCommand.InsertRange(Document, undoPos, insertString);
            }

            if (!deleteChar.IsEmpty)
            {
                lines[undoPos.Line].Insert(undoPos.Col, deleteChar);
            }

            if (pos.IsEmpty)
            {
                pos = undoPos;
            }

            return(Change);
        }
Example #5
0
 public override ActionResults Undo(out Pos pos)
 {
     undoPos = InsertRangeCommand.InsertRange(Document, undoPos, data);
     pos     = undoPos;
     return(Change);
 }