コード例 #1
0
ファイル: PythonConsole.cs プロジェクト: andr1976/dwsim6
        /// <summary>
        /// Processes characters entering into the text editor by the user.
        /// </summary>
        void textEditor_TextEntering(object sender, TextCompositionEventArgs e)
        {
            if (e.Text.Length > 0)
            {
                if (!char.IsLetterOrDigit(e.Text[0]))
                {
                    // Whenever a non-letter is typed while the completion window is open,
                    // insert the currently selected element.
                    textEditor.RequestCompletioninsertion(e);
                }
            }

            if (IsInReadOnlyRegion)
            {
                e.Handled = true;
            }
            else
            {
                if (e.Text[0] == '\n')
                {
                    UpdateVariables?.Invoke(commandLine.ScriptScope);
                    OnEnterKeyPressed();
                }

                if (e.Text[0] == '.' && allowFullAutocompletion)
                {
                    textEditor.ShowCompletionWindow();
                }

                if ((e.Text[0] == ' ') && (Keyboard.Modifiers == ModifierKeys.Control))
                {
                    e.Handled = true;
                    if (allowCtrlSpaceAutocompletion)
                    {
                        textEditor.ShowCompletionWindow();
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Processes characters entering into the text editor by the user.
        /// </summary>
        void textEditor_TextEntering(object sender, TextCompositionEventArgs e)
        {
            if (e.Text.Length > 0)
            {
                if (!char.IsLetterOrDigit(e.Text[0]) || e.Text[0] == '_') // Underscore is a fairly common character in Revit API names.
                {
                    // Whenever a non-letter is typed while the completion window is open,
                    // insert the currently selected element.
                    textEditor.RequestCompletioninsertion(e);
                }
            }

            if (IsInReadOnlyRegion)
            {
                e.Handled = true;
            }
            else
            {
                if (e.Text[0] == '\n')
                {
                    OnEnterKeyPressed();
                }

                if (e.Text[0] == '.' && allowFullAutocompletion)
                {
                    textEditor.ShowCompletionWindow();
                }

                if ((e.Text[0] == ' ') && (Keyboard.Modifiers == ModifierKeys.Control))
                {
                    e.Handled = true;
                    if (allowCtrlSpaceAutocompletion)
                    {
                        textEditor.ShowCompletionWindow();
                    }
                }
            }
        }