private void SelectFunctionInListForCurrentPosition()
{
lock (cmbFunctions)
{
_allowZoomToFunction = false;
int currentPos = scintilla.CurrentPos;
foreach (ScriptFunction func in _script.AutoCompleteData.Functions)
{
if ((currentPos >= func.StartsAtCharacterIndex) &&
(currentPos < func.EndsAtCharacterIndex))
{
int index = cmbFunctions.FindStringExact(func.FunctionName);
if (index >= 0)
{
cmbFunctions.SelectedIndex = index;
_allowZoomToFunction = true;
return;
}
}
}
foreach (ScriptStruct struc in _script.AutoCompleteData.Structs)
{
foreach (ScriptFunction func in struc.Functions)
{
if ((currentPos >= func.StartsAtCharacterIndex) &&
(currentPos < func.EndsAtCharacterIndex))
{
int index = cmbFunctions.FindStringExact(struc.Name + "::" + func.FunctionName);
if (index >= 0)
{
cmbFunctions.SelectedIndex = index;
_allowZoomToFunction = true;
return;
}
}
}
}
if (cmbFunctions.Items.Count > 0)
{
cmbFunctions.SelectedIndex = 0;
}
_allowZoomToFunction = true;
}
}