Don't find when the dialog isn't open or the search is blank (which resulted in full highlighting)

Fix #9056
This commit is contained in:
Marek Roszko 2021-09-04 23:48:06 -04:00
parent 3b7f5a3db7
commit 74b8f14ec3
1 changed files with 6 additions and 1 deletions

View File

@ -250,7 +250,12 @@ int SCH_EDITOR_CONTROL::UpdateFind( const TOOL_EVENT& aEvent )
auto visit = auto visit =
[&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet ) [&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet )
{ {
if( aItem->Matches( data, aSheet ) ) // We may get triggered when the dialog is not opened due to binding SelectedItemsModified
// we also get triggered when the find dialog is closed....so we need to double check the dialog is open
if( m_frame->m_findReplaceDialog != nullptr
&& !data.GetFindString().IsEmpty()
&& aItem->Matches( data, aSheet ) )
{ {
aItem->SetForceVisible( true ); aItem->SetForceVisible( true );
m_selectionTool->BrightenItem( aItem ); m_selectionTool->BrightenItem( aItem );