public ScriptTokenReference FindNextOccurrence(string text, bool caseSensitive, bool jumpToStart)
{
StringComparison comparisonType = StringComparison.CurrentCulture;
if (!caseSensitive)
{
comparisonType = StringComparison.CurrentCultureIgnoreCase;
}
string documentText = GetText();
int currentPos = this.scintillaControl1.CurrentPos;
int nextPos = -1;
if (currentPos < documentText.Length)
{
nextPos = documentText.IndexOf(text, currentPos, comparisonType);
}
if (nextPos < 0)
{
if (!jumpToStart)
{
return null;
}
nextPos = documentText.IndexOf(text, 0, comparisonType);
if (nextPos < 0)
{
return null;
}
}
SetSelection(nextPos, text.Length);
return GetTokenReferenceForCurrentState();
}