Exemplo n.º 1
0
        public void MarkTextAsError(int LineIndex, int CharPosStart, int CharLength)
        {
            if ((LineIndex < 0) ||
                (LineIndex >= SourceControl.LinesCount))
            {
                Debug.Log("MarkTextAsError lineindex out of bounds!");
                return;
            }
            // several warnings/errors in one line, mark the full line
            if ((LineIndex < m_LineInfos.Count) &&
                (m_LineInfos[LineIndex].HasCollapsedContent))
            {
                string lineText = SourceControl[LineIndex].Text;

                // find first non white space
                CharPosStart = 0;
                while ((CharPosStart < lineText.Length) &&
                       ((lineText[CharPosStart] == ' ') ||
                        (lineText[CharPosStart] == '\t')))
                {
                    ++CharPosStart;
                }
                CharLength = lineText.TrimEnd().Length - CharPosStart;
            }

            int startPos = SourceControl.VirtualPositionToPositionInLine(LineIndex, CharPosStart);

            var range = new FastColoredTextBoxNS.Range(SourceControl, new FastColoredTextBoxNS.Place(startPos, LineIndex), new FastColoredTextBoxNS.Place(startPos + CharLength, LineIndex));

            range.SetStyle(FastColoredTextBoxNS.StyleIndex.Style10);
        }