Alsing.Windows.Forms.SyntaxBox.EditViewControl.ReplaceSelection C# (CSharp) Method

ReplaceSelection() public method

public ReplaceSelection ( string text ) : bool
text string
return bool
        public bool ReplaceSelection(string text)
        {
            if (!Selection.IsValid)
                return false;

            int x = Selection.LogicalBounds.FirstColumn;
            int y = Selection.LogicalBounds.FirstRow;

            Selection.DeleteSelection();

            Caret.Position.X = x;
            Caret.Position.Y = y;

            InsertText(text);


            Selection.Bounds.FirstRow = y;
            Selection.Bounds.FirstColumn = x + text.Length;

            Selection.Bounds.LastRow = y;
            Selection.Bounds.LastColumn = x + text.Length;

            Caret.Position.X = x + text.Length;
            Caret.Position.Y = y;
            return true;
        }