private void syntaxEditor_KeyTyped(object sender, KeyTypedEventArgs e) { if (ShouldAutoPopupListMembers(e.KeyChar)) { ListMembers(); } }
private static void SimulateKey(IKeyboard keyboard, KeyCode key, string keyChar, KeyModifiers modifiers = null) { modifiers = modifiers ?? new KeyModifiers(); KeyPressedEventArgs keyDownEventArgs = new KeyPressedEventArgs { KeyChar = keyChar, VirtualKey = key, Modifiers = modifiers }; KeyTypedEventArgs keyPressEventArgs = new KeyTypedEventArgs { KeyChar = keyChar, VirtualKey = key, Modifiers = modifiers }; KeyReleasedEventArgs keyUpEventArgs = new KeyReleasedEventArgs { VirtualKey = key, Modifiers = modifiers }; keyboard.KeyPressed.Raise(keyDownEventArgs); keyboard.KeyTyped.Raise(keyPressEventArgs); keyboard.KeyReleased.Raise(keyUpEventArgs); }
protected override void OnSyntaxEditorKeyTyped(SyntaxEditor syntaxEditor, KeyTypedEventArgs e) { if (e.Command is IndentCommand) { this.ProcessTabKey(syntaxEditor); } else if (e.Command is TypingCommand) { switch (e.KeyChar) { case ' ': break; case '=': this.ProcessEqualsKey(syntaxEditor); break; default: this.isPotentiallyAddingEvent = false; break; } } else { this.isPotentiallyAddingEvent = false; } this.UpdateInternalState(syntaxEditor); base.OnSyntaxEditorKeyTyped(syntaxEditor, e); }
private void jsEditor1_KeyTyped(object sender, KeyTypedEventArgs e) { if (e.KeyData == (Keys.Shift | Keys.Control | Keys.F)) { JSBeautify js = new JSBeautify(jsEditor1.Text, new JSBeautifyOptions()); jsEditor1.Text = js.GetResult(); } }
private void jsEditor1_KeyTyped(object sender, KeyTypedEventArgs e) { if (e.KeyData == (Keys.Shift | Keys.Control | Keys.F)) { JSBeautify js = new JSBeautify(jsEditor1.Text, new JSBeautifyOptions()); jsEditor1.Text = js.GetResult(); } }
private static void SimulateKey(IKeyboard keyboard, KeyCode key, string keyChar) { KeyPressedEventArgs keyDownEventArgs = new KeyPressedEventArgs { KeyChar = keyChar, VirtualKey = key }; KeyTypedEventArgs keyPressEventArgs = new KeyTypedEventArgs { KeyChar = keyChar, VirtualKey = key }; KeyReleasedEventArgs keyUpEventArgs = new KeyReleasedEventArgs { VirtualKey = key }; keyboard.KeyPressed.Raise(keyDownEventArgs); keyboard.KeyTyped.Raise(keyPressEventArgs); keyboard.KeyReleased.Raise(keyUpEventArgs); }
protected override void OnSyntaxEditorKeyTyped(SyntaxEditor syntaxEditor, KeyTypedEventArgs e) { //TextStream scriptStream = syntaxEditor.Document.GetTextStream(syntaxEditor.Caret.Offset); switch (e.KeyChar) { case '{': break; case '}': BracketHighlighting brackets = syntaxEditor.SelectedView.BracketHighlighting; if (brackets.MatchingBracketToken == null) { break; } TokenStream startTokens = syntaxEditor.Document.GetTokenStream(brackets.MatchingBracketToken); int startLineStart; IToken startSpacer = GetLineIndent(startTokens, out startLineStart); TokenStream endTokens = syntaxEditor.Document.GetTokenStream(brackets.BracketToken); int endLineStart; IToken endSpacer = GetLineIndent(endTokens, out endLineStart); TextRange replace = endSpacer != null ? endSpacer.TextRange : new TextRange(endLineStart); if (replace.EndOffset != brackets.BracketToken.StartOffset) { break; } syntaxEditor.Document.ReplaceText(DocumentModificationType.AutoIndent, replace, startSpacer != null ? syntaxEditor.Document.GetTokenText(startSpacer) : String.Empty, DocumentModificationOptions.RetainSelection); break; } }
/// <summary> /// Occurs before a <see cref="SyntaxEditor.KeyTyped"/> event is raised /// for a <see cref="SyntaxEditor"/> that has a <see cref="Document"/> using this language. /// </summary> /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will raise the event.</param> /// <param name="e">An <c>KeyTypedEventArgs</c> that contains the event data.</param> protected override void OnSyntaxEditorKeyTyped(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, KeyTypedEventArgs e) { m_timeLastKey = DateTime.Now; if (e.KeyData == Keys.Up || e.KeyData == Keys.Down || e.KeyData == Keys.Left || e.KeyData == Keys.Right || e.KeyData == Keys.PageUp || e.KeyData == Keys.PageDown || e.KeyData == Keys.End || e.KeyData == Keys.Home) { m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.MovedCaret, syntaxEditor); } else if (e.KeyChar != 0 || e.KeyData == Keys.Delete || e.KeyData == Keys.Enter || e.KeyData == Keys.Back) { m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.Typed, syntaxEditor); } // Prevent overzealous auto completion if (0 != e.KeyChar && false == Char.IsLetterOrDigit(e.KeyChar)) { syntaxEditor.IntelliPrompt.MemberList.Abort(); } switch (e.KeyChar) { default: if (Char.IsLetter(e.KeyChar)) { ShowIntelliPromptMemberList(syntaxEditor); } break; case '.': case ':': // Show the parameter info for code ShowIntelliPromptMemberList(syntaxEditor); break; case '(': ShowIntelliPromptParameterInfo(syntaxEditor); break; case ')': ShowIntelliPromptParameterInfo(syntaxEditor); break; case ',': if ((!syntaxEditor.IntelliPrompt.ParameterInfo.Visible) && (syntaxEditor.SelectedView.GetCurrentToken().LexicalState == LexicalStates["DefaultState"])) { // Show the parameter info for the context level if parameter info is not already displayed ShowIntelliPromptParameterInfo(syntaxEditor); } break; } }
private void syntaxEditor_KeyTyped(object sender, KeyTypedEventArgs e) { if (ShouldAutoPopupListMembers(e.KeyChar)) ListMembers(); }
/// <summary> /// Occurs before a <see cref="SyntaxEditor.KeyTyped"/> event is raised /// for a <see cref="SyntaxEditor"/> that has a <see cref="Document"/> using this language. /// </summary> /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will raise the event.</param> /// <param name="e">An <c>KeyTypedEventArgs</c> that contains the event data.</param> protected override void OnSyntaxEditorKeyTyped(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, KeyTypedEventArgs e) { m_timeLastKey = DateTime.Now; if (e.KeyData == Keys.Up || e.KeyData == Keys.Down || e.KeyData == Keys.Left || e.KeyData == Keys.Right || e.KeyData == Keys.PageUp || e.KeyData == Keys.PageDown || e.KeyData == Keys.End || e.KeyData == Keys.Home) { m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.MovedCaret, syntaxEditor); } else if (e.KeyChar != 0 || e.KeyData == Keys.Delete || e.KeyData == Keys.Enter || e.KeyData == Keys.Back) { m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.Typed, syntaxEditor); } // Prevent overzealous auto completion if (0 != e.KeyChar && false == Char.IsLetterOrDigit(e.KeyChar)) { syntaxEditor.IntelliPrompt.MemberList.Abort(); } switch (e.KeyChar) { default: if (Char.IsLetter(e.KeyChar)) { ShowIntelliPromptMemberList(syntaxEditor); } break; case '.': case ':': // Show the parameter info for code ShowIntelliPromptMemberList(syntaxEditor); break; case '(': ShowIntelliPromptParameterInfo(syntaxEditor); break; case ')': ShowIntelliPromptParameterInfo(syntaxEditor); break; case ',': if ((!syntaxEditor.IntelliPrompt.ParameterInfo.Visible) && (syntaxEditor.SelectedView.GetCurrentToken().LexicalState == LexicalStates["DefaultState"])) { // Show the parameter info for the context level if parameter info is not already displayed ShowIntelliPromptParameterInfo(syntaxEditor); } break; } }