private void Scintilla_SelectionChanged(object sender, EventArgs e)
{
Range sr = Scintilla.Selection.Range;
if (this._snippetLinks.IsActive)
{
SnippetLink oldActiveSnippetLink = this._snippetLinks.ActiveSnippetLink;
SnippetLinkRange oldActiveRange = this._snippetLinks.ActiveRange;
this._snippetLinks.ActiveSnippetLink = null;
this._snippetLinks.ActiveRange = null;
for (int i = 0; i < this._snippetLinks.Count; i++)
{
SnippetLink sl = this._snippetLinks[i];
foreach (SnippetLinkRange r in sl.Ranges)
{
if (r.IntersectsWith(sr))
{
this._snippetLinks.ActiveSnippetLink = sl;
this._snippetLinks.ActiveRange = r;
break;
}
}
if (this._snippetLinks.ActiveRange != null)
break;
}
foreach (SnippetLink sl in this._snippetLinks.Values)
foreach (Range r in sl.Ranges)
{
if (sl == this._snippetLinks.ActiveSnippetLink)
{
r.ClearIndicator(Scintilla.Snippets.InactiveSnippetIndicator);
r.SetIndicator(Scintilla.Snippets.ActiveSnippetIndicator);
}
else
{
r.SetIndicator(Scintilla.Snippets.InactiveSnippetIndicator);
r.ClearIndicator(Scintilla.Snippets.ActiveSnippetIndicator);
}
}
}
}