public bool NextSnippetRange()
{
// This would be a whole lot easier if I had the Command Contexts set
// up. The way it's working now is that this command will always execute
// irregardlessly of if the SnippetLinks are active. Since we may not have
// a valid context to execute we don't necessarily want to eat the
// keystroke in all circumstances, hence the bool return
if (!_snippetLinks.IsActive || Scintilla.AutoComplete.IsActive)
return false;
// OK So we want to find the next SnippetLink in
// whatever order they are in and then select it
// so that they can fill it out.
SnippetLink sl = _snippetLinks.NextActiveSnippetLink;
if (sl != null)
{
// However it is possible that all of this Snippet Links'
// ranges have been deleted by the user. If this is the case
// we need to remove this snippet link from the list and go
// to the next link.
while (sl.Ranges.Count == 0)
{
_snippetLinks.Remove(sl);
sl = _snippetLinks.NextActiveSnippetLink;
// No more snippet links? Nothing to do but quit
if (sl == null)
{
Scintilla.Commands.StopProcessingCommands = true;
return true;
}
}
// Yay we have it. Select the first Range in the Snippet Link's Series
sl.Ranges[0].Select();
Scintilla.Commands.StopProcessingCommands = true;
return true;
}
return false;
}