Correctly de-highlight found items when closing Find dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/5775
This commit is contained in:
Jeff Young 2020-09-24 18:46:01 +01:00
parent f0739315f6
commit eaf151075c
2 changed files with 19 additions and 6 deletions

View File

@ -96,9 +96,6 @@ void DIALOG_SCH_FIND::OnClose( wxCloseEvent& aEvent )
{ {
// Notify the SCH_EDIT_FRAME // Notify the SCH_EDIT_FRAME
m_frame->OnFindDialogClose(); m_frame->OnFindDialogClose();
// Notify the controller
m_findDirty = true;
} }
@ -249,7 +246,7 @@ void DIALOG_SCH_FIND::OnFind( wxCommandEvent& aEvent )
m_comboFind->SetSelection( 0 ); m_comboFind->SetSelection( 0 );
} }
m_editorControl->FindNext( ACTIONS::findNext.MakeEvent()); m_editorControl->FindNext( ACTIONS::findNext.MakeEvent() );
} }
@ -271,14 +268,28 @@ void DIALOG_SCH_FIND::OnReplace( wxCommandEvent& aEvent )
} }
if( aEvent.GetId() == wxID_REPLACE ) if( aEvent.GetId() == wxID_REPLACE )
m_editorControl->ReplaceAndFindNext( ACTIONS::replaceAndFindNext.MakeEvent()); m_editorControl->ReplaceAndFindNext( ACTIONS::replaceAndFindNext.MakeEvent() );
else if( aEvent.GetId() == wxID_REPLACE_ALL ) else if( aEvent.GetId() == wxID_REPLACE_ALL )
m_editorControl->ReplaceAll( ACTIONS::replaceAll.MakeEvent()); m_editorControl->ReplaceAll( ACTIONS::replaceAll.MakeEvent() );
} }
wxArrayString DIALOG_SCH_FIND::GetFindEntries() const wxArrayString DIALOG_SCH_FIND::GetFindEntries() const
{ {
int index = m_comboFind->FindString( m_comboFind->GetValue(), true );
if( index == wxNOT_FOUND )
{
m_comboFind->Insert( m_comboFind->GetValue(), 0 );
}
else if( index != 0 )
{
/* Move the search string to the top of the list if it isn't already there. */
wxString tmp = m_comboFind->GetValue();
m_comboFind->Delete( index );
m_comboFind->Insert( tmp, 0 );
}
return m_comboFind->GetStrings(); return m_comboFind->GetStrings();
} }

View File

@ -824,6 +824,8 @@ void SCH_EDIT_FRAME::OnFindDialogClose()
m_findReplaceDialog->Destroy(); m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr; m_findReplaceDialog = nullptr;
m_toolManager->RunAction( ACTIONS::updateFind, true );
} }