Fix fuzzy search for keys in commnad palette.

Fix in premake4 project file.
This commit is contained in:
Martín Lucas Golini
2024-10-14 20:36:22 -03:00
parent 3d04112402
commit 8459f4e11f
3 changed files with 7 additions and 9 deletions

View File

@@ -75,15 +75,13 @@ CommandPalette::fuzzyMatch( const std::vector<std::vector<std::string>>& cmdPale
std::vector<std::vector<std::string>> ret;
for ( size_t i = 0; i < cmdPalette.size(); i++ ) {
int matchName = String::fuzzyMatch( cmdPalette[i][0], match );
int matchKeybind = String::fuzzyMatch( cmdPalette[i][1], match );
int matchName = String::fuzzyMatch( cmdPalette[i][0], match, true, true );
int matchKeybind = String::fuzzyMatch( cmdPalette[i][2], match, true, true );
matchesMap.insert( { std::max( matchName, matchKeybind ), i } );
}
for ( auto& res : matchesMap ) {
if ( ret.size() < max ) {
ret.push_back( { cmdPalette[res.second][0], cmdPalette[res.second][1],
cmdPalette[res.second][2] } );
}
if ( ret.size() < max )
ret.push_back( cmdPalette[res.second] );
}
return CommandPaletteModel::create( 3, ret );
}