Esempio n. 1
0
        private void MarkErrorWord(ActiproSoftware.SyntaxEditor.SyntaxEditor editor, int lineNumber, int characterPos, string message)
        {
            //string text = editor.Document.Lines[lineNumber].Text;
            //string preceedingText = characterPos <= compileText.Length ? compileText.Substring(0, characterPos) : "";

            ActiproSoftware.SyntaxEditor.DocumentPosition position = new ActiproSoftware.SyntaxEditor.DocumentPosition(lineNumber, characterPos);
            int          offset = editor.Document.PositionToOffset(position);
            DynamicToken token  = (DynamicToken)editor.Document.Tokens.GetTokenAtOffset(offset);

            ActiproSoftware.SyntaxEditor.SpanIndicator indicator = new ActiproSoftware.SyntaxEditor.WaveLineSpanIndicator("ErrorIndicator", Color.Red);
            indicator.Tag = message;
            ActiproSoftware.SyntaxEditor.SpanIndicatorLayer indicatorLayer = new ActiproSoftware.SyntaxEditor.SpanIndicatorLayer("kk", 1);
            editor.Document.SpanIndicatorLayers.Add(indicatorLayer);
            int startOffset = Math.Min(token.StartOffset, indicatorLayer.Document.Length - 1);
            int length      = Math.Max(token.Length, 1);

            indicatorLayer.Add(indicator, startOffset, length);

            syntaxEditor1.Document.Lines[lineNumber].BackColor = Slyce.Common.Colors.BackgroundColor;
            syntaxEditor1.SelectedView.GoToLine(lineNumber, (lineNumber > 2) ? 2 : 0); // Allow 2 blank lines above selection
        }
Esempio n. 2
0
        private void MarkErrorWord(ActiproSoftware.SyntaxEditor.SyntaxEditor editor, int lineNumber, int characterPos, string message)
        {
            ActiproSoftware.SyntaxEditor.DocumentPosition position = new ActiproSoftware.SyntaxEditor.DocumentPosition(lineNumber, characterPos);
            int offset = editor.Document.PositionToOffset(position);
            DynamicToken token = (DynamicToken)editor.Document.Tokens.GetTokenAtOffset(offset);
            ActiproSoftware.SyntaxEditor.SpanIndicator indicator = new ActiproSoftware.SyntaxEditor.WaveLineSpanIndicator("ErrorIndicator", Color.Red);
            indicator.Tag = message;
            ActiproSoftware.SyntaxEditor.SpanIndicatorLayer indicatorLayer = new ActiproSoftware.SyntaxEditor.SpanIndicatorLayer("kk", 1);
            editor.Document.SpanIndicatorLayers.Add(indicatorLayer);
            int startOffset = Math.Min(token.StartOffset, indicatorLayer.Document.Length - 1);
            int length = Math.Max(token.Length, 1);
            indicatorLayer.Add(indicator, startOffset, length);

            syntaxEditor1.Document.Lines[lineNumber].BackColor = Slyce.Common.Colors.BackgroundColor;
            syntaxEditor1.SelectedView.GoToLine(lineNumber, (lineNumber > 2) ? 2 : 0); // Allow 2 blank lines above selection
        }