File / path and command fuzzy match improvements.

This commit is contained in:
Martín Lucas Golini
2025-02-17 23:44:01 -03:00
parent 47c8aa0774
commit e86d92d190
3 changed files with 7 additions and 7 deletions

View File

@@ -118,8 +118,8 @@ ProjectDirectoryTree::fuzzyMatchTree( const std::vector<std::string>& matches, c
std::vector<std::string> names;
for ( const auto& match : matches ) {
for ( size_t i = 0; i < mNames.size(); i++ ) {
int matchName = String::fuzzyMatch( mNames[i], match );
int matchPath = String::fuzzyMatch( mFiles[i], match );
int matchName = String::fuzzyMatch( match, mNames[i], true );
int matchPath = String::fuzzyMatch( match, mFiles[i], true );
matchesMap.insert( { std::max( matchName, matchPath ), i } );
}
}
@@ -144,8 +144,8 @@ ProjectDirectoryTree::fuzzyMatchTree( const std::string& match, const size_t& ma
std::vector<std::string> files;
std::vector<std::string> names;
for ( size_t i = 0; i < mNames.size(); i++ ) {
int matchName = String::fuzzyMatch( mNames[i], match );
int matchPath = String::fuzzyMatch( mFiles[i], match );
int matchName = String::fuzzyMatch( match, mNames[i], true );
int matchPath = String::fuzzyMatch( match, mFiles[i], true );
matchesMap.insert( { std::max( matchName, matchPath ), i } );
}
for ( auto& res : matchesMap ) {