Example #1
0
        void HandleLineChanged(object sender, LineEventArgs e)
        {
            var lineNumber = e.Line.LineNumber;

            try {
                if (lineStates [lineNumber].state == Mono.TextEditor.TextDocument.LineState.Dirty)
                {
                    return;
                }
                lineStates [lineNumber] = new LineChangeInfo(Mono.TextEditor.TextDocument.LineState.Dirty);
                if (trackDocument != null)
                {
                    trackDocument.CommitLineUpdate(lineNumber);
                }
            } catch (Exception ex) {
                Console.WriteLine("error while DiffTracker.HandleLineChanged:" + ex);
            }
        }
Example #2
0
        void TrackDocument_TextChanged(object sender, MonoDevelop.Core.Text.TextChangeEventArgs e)
        {
            var startLine     = trackDocument.GetLineByOffset(e.Offset);
            var endLine       = trackDocument.GetLineByOffset(e.Offset + e.InsertionLength);
            var lineNumber    = startLine.LineNumber;
            var insertedLines = endLine.LineNumber - lineNumber;

            try {
                lineStates [lineNumber] = new LineChangeInfo(Mono.TextEditor.TextDocument.LineState.Dirty);
                if (trackDocument != null)
                {
                    trackDocument.CommitLineUpdate(lineNumber);
                }
                while (insertedLines-- > 0)
                {
                    lineStates.Insert(lineNumber, new LineChangeInfo(Mono.TextEditor.TextDocument.LineState.Dirty));
                }
            } catch (Exception ex) {
                Console.WriteLine("error while DiffTracker.TrackDocument_TextChanged:" + ex);
            }
        }