diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index 761d8bbbb7..27bbe28c5d 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -182,12 +182,12 @@ void LIB_TREE::ExpandLibId( const LIB_ID& aLibId ) } -void LIB_TREE::Regenerate() +void LIB_TREE::Regenerate( bool aKeepState ) { STATE current; // Store the state - if( !m_filtering ) + if( aKeepState ) m_unfilteredState = getState(); wxString filter = m_query_ctrl->GetValue(); @@ -196,7 +196,7 @@ void LIB_TREE::Regenerate() postPreselectEvent(); // Restore the state - if( !m_filtering ) + if( aKeepState ) setState( m_unfilteredState ); } @@ -297,7 +297,7 @@ void LIB_TREE::setState( const STATE& aState ) void LIB_TREE::onQueryText( wxCommandEvent& aEvent ) { - Regenerate(); + Regenerate( false ); // Required to avoid interaction with SetHint() // See documentation for wxTextEntry::SetHint diff --git a/common/widgets/lib_tree.h b/common/widgets/lib_tree.h index 822e8cbf4f..278a099dfe 100644 --- a/common/widgets/lib_tree.h +++ b/common/widgets/lib_tree.h @@ -111,7 +111,7 @@ public: /** * Regenerates the tree. */ - void Regenerate(); + void Regenerate( bool aKeepState ); void SetFocus() override; diff --git a/eeschema/widgets/symbol_tree_pane.cpp b/eeschema/widgets/symbol_tree_pane.cpp index f6f64bb2e3..15ecf2b457 100644 --- a/eeschema/widgets/symbol_tree_pane.cpp +++ b/eeschema/widgets/symbol_tree_pane.cpp @@ -119,7 +119,7 @@ SYMBOL_TREE_PANE::~SYMBOL_TREE_PANE() void SYMBOL_TREE_PANE::Regenerate() { if( m_tree ) - m_tree->Regenerate(); + m_tree->Regenerate( true ); } diff --git a/pcbnew/footprint_tree_pane.cpp b/pcbnew/footprint_tree_pane.cpp index ecc401e619..632a2e92cb 100644 --- a/pcbnew/footprint_tree_pane.cpp +++ b/pcbnew/footprint_tree_pane.cpp @@ -122,7 +122,7 @@ FOOTPRINT_TREE_PANE::~FOOTPRINT_TREE_PANE() void FOOTPRINT_TREE_PANE::Regenerate() { if( m_tree ) - m_tree->Regenerate(); + m_tree->Regenerate( true ); }