diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCodeCompletionBinding.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCodeCompletionBinding.cs index fb79e4d23c..fa1de75b7f 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCodeCompletionBinding.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCodeCompletionBinding.cs @@ -31,15 +31,7 @@ namespace ICSharpCode.XmlEditor public CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch) { - if (char.IsWhiteSpace(ch) || editor.SelectionLength > 0) - return CodeCompletionKeyPressResult.None; - if (ignoredChars.Contains(ch)) - return CodeCompletionKeyPressResult.None; - if (XmlParser.GetXmlIdentifierBeforeIndex(editor.Document, editor.Caret.Offset).Length > 0) - return CodeCompletionKeyPressResult.None; - editor.Document.Insert(editor.Caret.Offset, ch.ToString()); - CtrlSpace(editor); - return CodeCompletionKeyPressResult.EatKey; + return CodeCompletionKeyPressResult.None; } XmlCompletionItemCollection GetCompletionItems(ITextEditor editor, XmlSchemaCompletion defaultSchema) @@ -88,7 +80,13 @@ namespace ICSharpCode.XmlEditor public bool HandleKeyPressed(ITextEditor editor, char ch) { - return false; + if (char.IsWhiteSpace(ch) || editor.SelectionLength > 0) + return false; + if (ignoredChars.Contains(ch)) + return false; + if (XmlParser.GetXmlIdentifierBeforeIndex(editor.Document, editor.Caret.Offset).Length > 1) + return false; + return CtrlSpace(editor); } } } diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs index 2f4ee1934d..a1f93f026b 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs @@ -7,6 +7,7 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Xml; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.SharpDevelop; namespace ICSharpCode.XmlEditor @@ -689,7 +690,7 @@ namespace ICSharpCode.XmlEditor return (ch == '\"') || (ch == '\''); } - public static string GetXmlIdentifierBeforeIndex(ITextBuffer document, int index) + public static string GetXmlIdentifierBeforeIndex(ITextSource document, int index) { if (document == null) throw new ArgumentNullException("document");