~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Change.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
                                return null;
102
102
                        foreach (var doc in IdeApp.Workbench.Documents) {
103
103
                                if (doc.FileName == fileName) {
104
 
                                        TextEditorData result = doc.TextEditorData;
 
104
                                        TextEditorData result = doc.Editor;
105
105
                                        if (result != null) {
106
106
                                                textEditorDatas.Add (result);
107
107
                                                result.Document.BeginAtomicUndo ();
132
132
                                        rctx.Save ();
133
133
                                }
134
134
                        } else if (textEditorData != null) {
 
135
                                int offset = textEditorData.Caret.Offset;
135
136
                                int charsInserted = textEditorData.Replace (Offset, RemovedChars, InsertedText);
136
 
                                if (MoveCaretToReplace)
 
137
                                if (MoveCaretToReplace) {
137
138
                                        textEditorData.Caret.Offset = Offset + charsInserted;
 
139
                                } else {
 
140
                                        if (Offset < offset) {
 
141
                                                int rem = RemovedChars;
 
142
                                                if (Offset + rem > offset)
 
143
                                                        rem = offset - Offset;
 
144
                                                textEditorData.Caret.Offset = offset - rem + charsInserted;
 
145
                                        }
 
146
                                }
138
147
                        }
139
148
                }
140
149