Example #1
0
        private void EditorStyleNeeded(object sender, StyleNeededEventArgs e)
        {
            statement = new CommandParser(ContinuationStatement?.Clone()).Parse(commandEditor.Text);
            commandEditor.Styles.ClearStyles(0);

            if (statement == null)
            {
                return;
            }

            if (statement.Location.End != statement.Location.Start)
            {
                commandEditor.Styles.StyleRange(StandardStyle.Keyword, 0,
                                                statement.Location.Start, statement.Location.End);
            }

            if (statement.HasArguments)
            {
                foreach (var a in statement.Arguments)
                {
                    commandEditor.Styles.StyleRange(StandardStyle.KeywordSpecial, 0,
                                                    a.Location.Start, a.Location.End);
                }
            }
        }
Example #2
0
        private void ExecuteCommand(string command)
        {
            statement = new CommandParser(ContinuationStatement?.Clone()).Parse(command);
            var md = statement != null && statement.Command != null
                ? App.Component <ICommandProvider>().GetCommandByAlias(statement.Command) : null;

            if (md != null)
            {
                var args = statement.HasArguments
                    ? statement.Arguments.Select(a => a.Value).ToArray() : defargs;
                statement             = null;
                ContinuationStatement = null;
                CloseInput();
                App.Ext.Run(editor, md.Key, args);
            }
        }