~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/Mono.Texteditor/Mono.TextEditor/EditMode.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
                public virtual bool WantsToPreemptIM {
104
104
                        get { return false; }
105
105
                }
106
 
                
 
106
 
 
107
                bool IsSpecialKeyForSelection (uint unicodeKey)
 
108
                {
 
109
                        string start, end;
 
110
                        return textEditorData.SelectionSurroundingProvider.GetSelectionSurroundings (textEditorData, unicodeKey, out start, out end);
 
111
                }
 
112
 
107
113
                protected void InsertCharacter (uint unicodeKey)
108
114
                {
109
115
                        if (!textEditorData.CanEdit (Data.Caret.Line))
110
116
                                return;
111
 
                        
 
117
 
112
118
                        HideMouseCursor ();
113
119
 
114
120
                        using (var undo = Document.OpenUndoGroup ()) {
 
121
                                if (textEditorData.IsSomethingSelected && textEditorData.Options.EnableSelectionWrappingKeys && IsSpecialKeyForSelection (unicodeKey)) {
 
122
                                        textEditorData.SelectionSurroundingProvider.HandleSpecialSelectionKey (textEditorData, unicodeKey);
 
123
                                        return;
 
124
                                }
 
125
 
115
126
                                textEditorData.DeleteSelectedText (
116
127
                                        textEditorData.IsSomethingSelected ? textEditorData.MainSelection.SelectionMode != SelectionMode.Block : true);
117
128
                                // Needs to be called after delete text, delete text handles virtual caret postitions itself,
143
154
                                                                }
144
155
                                                                textEditorData.Insert (lineSegment.Offset + insertOffset, textToInsert);
145
156
                                                        }
 
157
                                                        var visualColumn = textEditorData.GetLine (Caret.Location.Line).GetVisualColumn (textEditorData, Caret.Column);
146
158
 
147
159
                                                        textEditorData.MainSelection = new Selection (
148
 
                                                                new DocumentLocation (selection.Anchor.Line, Caret.Column),
149
 
                                                                new DocumentLocation (selection.Lead.Line, Caret.Column),
150
 
                                                                Mono.TextEditor.SelectionMode.Block);
 
160
                                                                new DocumentLocation (selection.Anchor.Line, textEditorData.GetLine (selection.Anchor.Line).GetLogicalColumn (textEditorData, visualColumn)),
 
161
                                                                new DocumentLocation (selection.Lead.Line, textEditorData.GetLine (selection.Lead.Line).GetLogicalColumn (textEditorData, visualColumn)),
 
162
                                                                SelectionMode.Block
 
163
                                                                );
151
164
                                                        Document.CommitMultipleLineUpdate (textEditorData.MainSelection.MinLine, textEditorData.MainSelection.MaxLine);
152
165
                                                } else {
153
166
                                                        textEditorData.Insert (Caret.Offset, text);
253
266
                        if (editor != null)
254
267
                                editor.HideMouseCursor ();
255
268
                }
 
269
 
 
270
                #region TextAreaControl
 
271
                public virtual void AllocateTextArea (TextEditor textEditor, TextArea textArea, Rectangle allocation)
 
272
                {
 
273
                        if (textArea.Allocation != allocation)
 
274
                                textArea.SizeAllocate (allocation);
 
275
                }
 
276
                #endregion
256
277
        }
257
278
}