FastColoredTextBoxNS.InsertTextCommand.Execute C# (CSharp) Method

Execute() public method

Execute operation
public Execute ( ) : void
return void
        public override void Execute()
        {
            ts.OnTextChanging(ref InsertedText);
            InsertText(InsertedText, ts);
            base.Execute();
        }

Usage Example

示例#1
0
        private void ExecuteInsertTextCommand(ref int iChar, string text)
        {
            var lines = text.Split('\n');
            var iLine = 0;

            foreach (var r in range.GetSubRanges(true))
            {
                var line        = ts.CurrentTB[r.Start.iLine];
                var lineIsEmpty = r.End < r.Start && line.StartSpacesCount == line.Count;
                if (!lineIsEmpty)
                {
                    var insertedText = lines[iLine % lines.Length];
                    if (r.End < r.Start && insertedText != "")
                    {
                        //add forwarding spaces
                        insertedText = new string( ' ', r.Start.iChar - r.End.iChar ) + insertedText;
                        r.Start      = r.End;
                    }
                    ts.CurrentTB.Selection = r;
                    var c = new InsertTextCommand(ts, insertedText);
                    c.Execute();
                    if (ts.CurrentTB.Selection.End.iChar > iChar)
                    {
                        iChar = ts.CurrentTB.Selection.End.iChar;
                    }
                    commandsByRanges.Add(c);
                }
                iLine++;
            }
        }
All Usage Examples Of FastColoredTextBoxNS.InsertTextCommand::Execute