public void scrollToLine(CodeLocation location)
 {
     int currentLine = m_scintilla.FirstVisibleLine;
     m_scintilla.LineScroll(location.Line - currentLine - 1, 0);
 }
        public void HighLightLine(CodeLocation location, HighLightType HightLightType)
        {
            // Indicators 0-7 could be in use by a lexer

            switch (HightLightType)
            {
                case HighLightType.ERROR:
                    m_scintilla.IndicatorCurrent = 8;
                    m_scintilla.Indicators[8].ForeColor = Color.Red;
                    m_scintilla.Indicators[8].Style = IndicatorStyle.Squiggle;
                    m_scintilla.Indicators[8].Under = true;
                    m_scintilla.Indicators[8].OutlineAlpha = 100;
                    m_scintilla.Indicators[8].Alpha = 100;
                    break;
                case HighLightType.WARNING:
                    m_scintilla.IndicatorCurrent = 9;
                    m_scintilla.Indicators[9].ForeColor = Color.Orange;
                    m_scintilla.Indicators[9].Style = IndicatorStyle.Squiggle;
                    m_scintilla.Indicators[9].Under = true;
                    m_scintilla.Indicators[9].OutlineAlpha = 100;
                    m_scintilla.Indicators[9].Alpha = 100;
                    break;
                case HighLightType.NORMAL_HIGHLIGHT:
                    clearHighLight();
                    m_scintilla.IndicatorCurrent = 10;
                    m_scintilla.Indicators[10].ForeColor = Color.Red;
                    m_scintilla.Indicators[10].Style = IndicatorStyle.DotBox;
                    m_scintilla.Indicators[10].Under = true;
                    m_scintilla.Indicators[10].OutlineAlpha = 100;
                    m_scintilla.Indicators[10].Alpha = 100;
                    break;
                default:
                    break;
            }
            // Update indicator appearance

            m_scintilla.TargetStart = getstartPosFromSourceLocation(location);
            m_scintilla.TargetEnd =   m_scintilla.Lines[location.Line-1].Text.Length;
            m_scintilla.IndicatorFillRange(m_scintilla.TargetStart, m_scintilla.TargetEnd - location.Column);
        }
 public CodeLocation GetCodeLocationFromPosition(int position)
 {
     CodeLocation location = new CodeLocation();
     location.Line = m_scintilla.LineFromPosition(position)+1;
     location.Column = position - m_scintilla.Lines[location.Line].Position;
     return location;
 }
 public int getstartPosFromSourceLocation(CodeLocation location)
 {
     if (location.Line <= m_scintilla.Lines.Count)
     {
         int line = location.Line;
         int Column = location.Column;
         int position = 0;
         position = m_scintilla.Lines[line - 1].Position;
         position += Column - 1;
         return position;
     }
     else
     {
         return 0;
     }
 }
 public void clearHighLight(CodeLocation location)
 {
     int startPos = getstartPosFromSourceLocation(location);
     if (location.Line <= m_scintilla.Lines.Count)
     {
         m_scintilla.IndicatorClearRange(startPos, m_scintilla.Lines[location.Line - 1].Text.Length);
     }
     m_scintilla.Invalidate();
 }