1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Improved performance of fuzzy string matching

This commit is contained in:
Simon Lübeß 2021-12-18 22:28:44 +01:00
parent b70745ef1e
commit 04888b8f10
4 changed files with 79 additions and 70 deletions

View file

@ -8024,26 +8024,25 @@ void BfCompiler::GenerateAutocompleteInfo()
autoCompleteResultString += '@';
autoCompleteResultString += String(entry->mDisplay);
autoCompleteResultString += "\x02";
for (int i = 0; i < 256; i++)
if (entry->mMatchesLength > 0)
{
int match = entry->mMatches[i];
autoCompleteResultString += "\x02";
for (int i = 0; i < entry->mMatchesLength; i++)
{
int match = entry->mMatches[i];
// no more matches after this
if (match == 0 && i != 0)
break;
// Need max 3 chars (largest Hex (FF) + '\0')
char buffer[3];
// Need max 3 chars (largest Hex (FF) + '\0')
char buffer[3];
_itoa_s(match, buffer, 16);
_itoa_s(match, buffer, 16);
autoCompleteResultString += String(buffer);
autoCompleteResultString += ",";
}
autoCompleteResultString += String(buffer);
autoCompleteResultString += ",";
autoCompleteResultString += "X";
}
autoCompleteResultString += "X";
if (entry->mDocumentation != NULL)
{
autoCompleteResultString += '\x03';