コード例 #1
0
        private void AddSquiggles(ScintillaControl sci, int line, int start, int end)
        {
            if (sci == null)
            {
                return;
            }
            fileWithSquiggles = CurrentFile;
            int position = sci.PositionFromLine(line) + start;

            sci.AddHighlight(2, (int)IndicatorStyle.Squiggle, 0x000000ff, position, end - start);
        }
コード例 #2
0
ファイル: PluginUI.cs プロジェクト: nestle1998/flashdevelop
        /// <summary>
        /// Squiggle one result
        /// </summary>
        private void AddSquiggle(ListViewItem item)
        {
            bool  fixIndexes = true;
            Match match      = errorCharacters.Match(item.SubItems[2].Text);

            if (match.Success)
            {
                // An error with this pattern is most likely a MTASC error (not multibyte)
                if (item.ImageIndex != 0)
                {
                    fixIndexes = false;
                }
            }
            else
            {
                match = errorCharacter.Match(item.SubItems[2].Text);
            }
            if (!match.Success)
            {
                match = errorCharacters2.Match(item.SubItems[2].Text);
            }
            if (match.Success)
            {
                String            fname     = (item.SubItems[4].Text + "\\" + item.SubItems[3].Text).Replace('/', '\\').Trim();
                Int32             line      = Convert.ToInt32(item.SubItems[1].Text) - 1;
                ITabbedDocument[] documents = PluginBase.MainForm.Documents;
                foreach (ITabbedDocument document in documents)
                {
                    if (!document.IsEditable)
                    {
                        continue;
                    }
                    ScintillaControl sci      = document.SciControl;
                    Language         language = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage);
                    Int32            style    = (item.ImageIndex == 0) ? (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox : (Int32)ScintillaNet.Enums.IndicatorStyle.Squiggle;
                    Int32            fore     = (item.ImageIndex == 0) ? language.editorstyle.HighlightBackColor : 0x000000ff;
                    Int32            indic    = (item.ImageIndex == 0) ? 0 : 2;
                    if (fname == document.FileName)
                    {
                        Int32 end;
                        Int32 start = Convert.ToInt32(match.Groups["start"].Value);
                        // start column is (probably) a multibyte length
                        if (fixIndexes)
                        {
                            start = this.MBSafeColumn(sci, line, start);
                        }
                        if (match.Groups["end"] != null && match.Groups["end"].Success)
                        {
                            end = Convert.ToInt32(match.Groups["end"].Value);
                            // end column is (probably) a multibyte length
                            if (fixIndexes)
                            {
                                end = this.MBSafeColumn(sci, line, end);
                            }
                        }
                        else
                        {
                            start = Math.Max(1, Math.Min(sci.LineLength(line) - 1, start));
                            end   = start--;
                        }
                        if ((start >= 0) && (end > start) && (end < sci.TextLength))
                        {
                            Int32 position = sci.PositionFromLine(line) + start;
                            sci.AddHighlight(indic, style, fore, position, end - start);
                        }
                        break;
                    }
                }
            }
        }