diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2012-03-11 01:07:29 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2012-03-11 01:07:29 +0400 |
commit | 11bbc52e2d117975ab4579676be144576ebbc600 (patch) | |
tree | daf29733676a80515cb685f7798f9323236376d9 /main/src/addins/VersionControl | |
parent | 2459db3685c1c2042e6ec1f1c81aeb3cbaa9110e (diff) |
[TextEditor] Renamed 'ReplaceEventArgs' to 'DocumentChangeEventArgs'
and based it on the NRefactory.TextChangeEventArgs.
I like the NRefactory version more and I need to make our text editor
more compatible with the NRefactory interfaces to support the next
generation Scripting engine. I plan to do it with a 'bridge', but I'll
always try to take better approaches.
Diffstat (limited to 'main/src/addins/VersionControl')
3 files changed, 15 insertions, 15 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs index db48c504d0..ecc20e86b5 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs @@ -562,11 +562,11 @@ namespace MonoDevelop.VersionControl.Views /// <summary> /// Marks necessary lines modified when text is replaced /// </summary> - private void EditorDocumentTextReplacing (object sender, ReplaceEventArgs e) + private void EditorDocumentTextReplacing (object sender, DocumentChangeEventArgs e) { - int startLine = widget.Editor.Document.OffsetToLineNumber (e.Offset), - endLine = widget.Editor.Document.OffsetToLineNumber (e.Offset + Math.Max (e.Count, e.Value != null ? e.Value.Length : 0)), - lineCount = 0; + int startLine = widget.Editor.Document.OffsetToLineNumber (e.Offset), + endLine = widget.Editor.Document.OffsetToLineNumber (e.Offset + Math.Max (e.RemovalLength, e.InsertionLength)), + lineCount = 0; string[] tokens = null; if (startLine < endLine) { @@ -577,14 +577,14 @@ namespace MonoDevelop.VersionControl.Views if (lineCount > 0) annotations.RemoveRange (startLine - 1, lineCount); - if (!string.IsNullOrEmpty (e.Value)) { + if (!string.IsNullOrEmpty (e.InsertedText)) { for (int i=0; i<lineCount; ++i) annotations.Insert (startLine - 1, locallyModified); } return; - } else if (0 == e.Count) { - // insert - tokens = e.Value.Split (new string[]{Environment.NewLine}, StringSplitOptions.None); + } else if (0 == e.RemovalLength) { + // insert + tokens = e.InsertedText.Split (new string[]{Environment.NewLine}, StringSplitOptions.None); lineCount = tokens.Length - 1; for (int i=0; i<lineCount; ++i) { annotations.Insert (Math.Min (startLine, annotations.Count), locallyModified); diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs index 85603cf842..6e739875a6 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs @@ -578,11 +578,11 @@ namespace MonoDevelop.VersionControl.Views List<TextEditorData> localUpdate = new List<TextEditorData> (); - void HandleInfoDocumentTextEditorDataDocumentTextReplaced (object sender, ReplaceEventArgs e) + void HandleInfoDocumentTextEditorDataDocumentTextReplaced (object sender, DocumentChangeEventArgs e) { foreach (var data in localUpdate.ToArray ()) { data.Document.TextReplaced -= HandleDataDocumentTextReplaced; - data.Replace (e.Offset, e.Count, e.Value); + data.Replace (e.Offset, e.RemovalLength, e.InsertedText); data.Document.TextReplaced += HandleDataDocumentTextReplaced; data.Document.CommitUpdateAll (); } @@ -614,13 +614,13 @@ namespace MonoDevelop.VersionControl.Views data.Document.TextReplaced += HandleDataDocumentTextReplaced; } - void HandleDataDocumentTextReplaced (object sender, ReplaceEventArgs e) + void HandleDataDocumentTextReplaced (object sender, DocumentChangeEventArgs e) { - var data = dict[(Document)sender]; + var data = dict [(Document)sender]; localUpdate.Remove (data); var editor = info.Document.GetContent<IEditableTextFile> (); - editor.DeleteText (e.Offset, e.Count); - editor.InsertText (e.Offset, e.Value); + editor.DeleteText (e.Offset, e.RemovalLength); + editor.InsertText (e.Offset, e.InsertedText); localUpdate.Add (data); UpdateDiff (); } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs index 25b03dbbb5..8a43ab04a4 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs @@ -246,7 +246,7 @@ namespace MonoDevelop.VersionControl.Views } } - void UpdateConflictsOnTextReplace (object sender, ReplaceEventArgs e) + void UpdateConflictsOnTextReplace (object sender, DocumentChangeEventArgs e) { this.UpdateDiff (); Mono.TextEditor.Document.UpdateSegments (GetAllConflictingSegments (), e); |