Flood.GUI.Controls.TextBox.InsertText C# (CSharp) Method

InsertText() private method

Inserts text at current cursor position, erasing selection if any.
private InsertText ( String text ) : void
text String Text to insert.
return void
        void InsertText(String text)
        {
            // TODO: Make sure fits (implement maxlength)

            if (HasSelection)
            {
                EraseSelection();
            }

            if (m_CursorPos > TextLength)
                m_CursorPos = TextLength;

            if (!IsTextAllowed(text, m_CursorPos))
                return;

            String str = Text;
            str = str.Insert(m_CursorPos, text);
            SetText(str);

            m_CursorPos += text.Length;
            m_CursorEnd = m_CursorPos;

            RefreshCursorBounds();
        }