diff options
Diffstat (limited to 'main/src/addins/Xml/Completion')
-rw-r--r-- | main/src/addins/Xml/Completion/XmlCompletionData.cs | 21 | ||||
-rw-r--r-- | main/src/addins/Xml/Completion/XmlTagCompletionData.cs | 14 |
2 files changed, 17 insertions, 18 deletions
diff --git a/main/src/addins/Xml/Completion/XmlCompletionData.cs b/main/src/addins/Xml/Completion/XmlCompletionData.cs index c3c77f6e94..3eb5a504c9 100644 --- a/main/src/addins/Xml/Completion/XmlCompletionData.cs +++ b/main/src/addins/Xml/Completion/XmlCompletionData.cs @@ -22,15 +22,19 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-using System; -using Gdk;
-using Mono.TextEditor;
+using Gdk; +using Gtk; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Ide.CodeCompletion;
+using System;
using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Commands;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Xml.Editor;
+using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Xml.Completion
{
@@ -104,18 +108,15 @@ namespace MonoDevelop.Xml.Completion } }
- public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, ModifierType modifier)
+ public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, KeyDescriptor descriptor)
{
if (XmlEditorOptions.AutoInsertFragments && dataType == DataType.XmlAttribute) {
- var textEditorDataProvier = window.CompletionWidget as ITextEditorDataProvider;
- var textBuffer = window.CompletionWidget as ITextBuffer;
- base.InsertCompletionText (window, ref ka, closeChar, keyChar, modifier);
- if (textEditorDataProvier != null && textBuffer != null)
- textEditorDataProvier.GetTextEditorData ().SetSkipChar (textBuffer.CursorPosition, '"');
+ base.InsertCompletionText (window, ref ka, descriptor);
+ window.CompletionWidget.AddSkipChar (window.CompletionWidget.CaretOffset, '"');
IdeApp.CommandService.DispatchCommand (TextEditorCommands.ShowCompletionWindow);
ka &= ~KeyActions.CloseWindow;
} else {
- base.InsertCompletionText (window, ref ka, closeChar, keyChar, modifier);
+ base.InsertCompletionText (window, ref ka, descriptor);
}
}
diff --git a/main/src/addins/Xml/Completion/XmlTagCompletionData.cs b/main/src/addins/Xml/Completion/XmlTagCompletionData.cs index befc32f068..e0d08b5ef2 100644 --- a/main/src/addins/Xml/Completion/XmlTagCompletionData.cs +++ b/main/src/addins/Xml/Completion/XmlTagCompletionData.cs @@ -31,6 +31,7 @@ using System; using MonoDevelop.Ide.CodeCompletion; using MonoDevelop.Ide.Gui.Content; using MonoDevelop.Core; +using MonoDevelop.Ide.Editor.Extension; namespace MonoDevelop.Xml.Completion { @@ -66,20 +67,17 @@ namespace MonoDevelop.Xml.Completion get { return element; } } - public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, Gdk.ModifierType modifier) + public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, KeyDescriptor descriptor) { - IEditableTextBuffer buf = window.CompletionWidget as IEditableTextBuffer; + var buf = window.CompletionWidget; if (buf != null) { //completion context gets nulled from window as soon as we alter the buffer var codeCompletionContext = window.CodeCompletionContext; - using (var undo = buf.OpenUndoGroup ()) { - buf.InsertText (buf.CursorPosition, element); + buf.Replace (buf.CaretOffset, 0, element); - // Move caret into the middle of the tags - buf.CursorPosition = codeCompletionContext.TriggerOffset + cursorOffset; - buf.Select (buf.CursorPosition, buf.CursorPosition); - }
+ // Move caret into the middle of the tags + buf.CaretOffset = codeCompletionContext.TriggerOffset + cursorOffset; } } } |