in src/common/details/console/gui/controls/SpeedSearchListBoxControl.cs [158:233]
protected bool SelectRowContaining(string searchFor, int startWithRow, bool startsWith = true, bool containsExact = true, bool containsRegex = true, bool containsChars = true, int direction = +1)
{
if (GetNumRows() == 0)
{
return false;
}
searchFor = searchFor.ToLower();
startWithRow = MinMaxRow(startWithRow);
// try to find exact match of what's been typed at the very beginning of the string
if (startsWith)
{
var row = startWithRow;
do
{
if (RowStartsWith(row, searchFor, out int col, out int width))
{
return SetSelectedSpeedSearchRow(row, col, width);
}
row = MinMaxRow(row + direction);
}
while (row != startWithRow);
}
// try to find exact match of what's been typed, anywhere in the items
if (containsExact)
{
var row = startWithRow;
do
{
if (RowContainsExactMatch(row, searchFor, out int col, out int width))
{
return SetSelectedSpeedSearchRow(row, col, width);
}
row = MinMaxRow(row + direction);
}
while (row != startWithRow);
}
// try to find a regexp match of what's been typed, anywhere in the items
if (containsRegex)
{
var row = startWithRow;
do
{
if (RowContainsRegex(row, searchFor, out int col, out int width))
{
return SetSelectedSpeedSearchRow(row, col, width);
}
row = MinMaxRow(row + direction);
}
while (row != startWithRow);
}
// if not found, try finding just based on character matches
if (containsChars)
{
var row = startWithRow;
do
{
if (RowContainsAllCharsInOrder(row, searchFor, out int col, out int width))
{
return SetSelectedSpeedSearchRow(row, col, width);
}
row = MinMaxRow(row + direction);
}
while (row != startWithRow);
}
return false;
}