mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-01 02:56:28 +03:00
Fix fuzzy search for keys in commnad palette.
Fix in premake4 project file.
This commit is contained in:
@@ -1090,7 +1090,7 @@ solution "eepp"
|
||||
set_targetdir("libs/" .. os.get_real() .. "/thirdparty/")
|
||||
includedirs { "src/thirdparty/libvorbis/lib/", "src/thirdparty/libogg/include", "src/thirdparty/libvorbis/include" }
|
||||
files { "src/thirdparty/libogg/**.c", "src/thirdparty/libvorbis/**.c" }
|
||||
build_base_cpp_configuration( "vorbis" )
|
||||
build_base_configuration( "vorbis" )
|
||||
|
||||
project "pugixml-static"
|
||||
kind "StaticLib"
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ void UniversalLocator::updateCommandPaletteTable() {
|
||||
|
||||
if ( txt.size() > 1 ) {
|
||||
#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined( __EMSCRIPTEN_PTHREADS__ )
|
||||
mCommandPalette.asyncFuzzyMatch( txt.substr( 1 ), 1000, [this]( auto res ) {
|
||||
mCommandPalette.asyncFuzzyMatch( txt.substr( 1 ).trim(), 10000, [this]( auto res ) {
|
||||
mUISceneNode->runOnMainThread( [this, res] {
|
||||
mLocateTable->setModel( res );
|
||||
mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) );
|
||||
@@ -411,7 +411,7 @@ void UniversalLocator::updateCommandPaletteTable() {
|
||||
} );
|
||||
} );
|
||||
#else
|
||||
mLocateTable->setModel( mCommandPalette.fuzzyMatch( txt.substr(), 1000 ) );
|
||||
mLocateTable->setModel( mCommandPalette.fuzzyMatch( txt.substr( 1 ).trim(), 10000 ) );
|
||||
mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) );
|
||||
mLocateTable->scrollToTop();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user