From 02bc093b55f15c8765c9a426630c9a228b228f28 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 15 May 2024 10:54:41 +0100 Subject: [PATCH] Use consistent sorting for footprint libs. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17731 --- cvpcb/cvpcb_mainframe.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index e12724ad67..8a11f71276 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -992,8 +992,19 @@ void CVPCB_MAINFRAME::BuildLibrariesList() COMMON_SETTINGS* cfg = Pgm().GetCommonSettings(); PROJECT_FILE& project = Kiway().Prj().GetProjectFile(); FP_LIB_TABLE* tbl = PROJECT_PCB::PcbFootprintLibs( &Prj() ); - std::set pinnedMatches; - std::set otherMatches; + + // Use same sorting algorithm as LIB_TREE_NODE::AssignIntrinsicRanks + struct library_sort + { + bool operator()( const wxString& lhs, const wxString& rhs ) const + { + return StrNumCmp( lhs, rhs, true ) < 0; + } + }; + + std::set pinnedMatches; + std::set otherMatches; + m_librariesListBox->ClearList(); auto process =