Support parital matches for libraries.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16400
This commit is contained in:
Jeff Young 2023-12-20 12:45:42 +00:00
parent 922aee1532
commit df161c9886
2 changed files with 4 additions and 4 deletions

View File

@ -247,7 +247,7 @@ void LIB_TREE_NODE_ITEM::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxSt
m_Score += aMatcher->ScoreTerms( m_SearchTerms ); m_Score += aMatcher->ScoreTerms( m_SearchTerms );
// aLib test is additive // aLib test is additive
if( !aLib.IsEmpty() && m_Parent->m_Name.Lower() == aLib ) if( !aLib.IsEmpty() && m_Parent->m_Name.Lower().Matches( aLib ) )
m_Score += 1; m_Score += 1;
// aFilter test is subtractive // aFilter test is subtractive
@ -294,7 +294,7 @@ void LIB_TREE_NODE_LIBRARY::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const w
} }
// aLib test is additive // aLib test is additive
if( !aLib.IsEmpty() && m_Name.Lower() == aLib ) if( !aLib.IsEmpty() && m_Name.Lower().Matches( aLib ) )
m_Score += 1; m_Score += 1;
// aMatcher test is additive // aMatcher test is additive

View File

@ -265,8 +265,8 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( const wxString& aSearch, bool a
} }
else else
{ {
// In case the full token happens to be a library name // In case the full token happens to match a library name
m_tree.UpdateScore( nullptr, term, nullptr ); m_tree.UpdateScore( nullptr, '*' + term + '*', nullptr );
} }
} }