From 5d967289ee2b825ce1be2301d27a52dbe4db57ec Mon Sep 17 00:00:00 2001 From: John Beard Date: Mon, 1 Sep 2025 20:46:59 +0800 Subject: [PATCH] Eeschema: order pins by number, not position Also use StrNumCmp, then the pin numbers are ordered exactly the same way as pads in footprints. --- eeschema/sch_pin.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index fb41e49424..7703fb63a1 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -1456,8 +1456,10 @@ wxString SCH_PIN::getItemDescription( ALT* aAlt ) const int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const { - // Ignore the UUID here. - int retv = SCH_ITEM::compare( aOther, aCompareFlags | SCH_ITEM::COMPARE_FLAGS::EQUALITY ); + // Ignore the UUID here + // And the position, which we'll do after the number. + int retv = SCH_ITEM::compare( aOther, aCompareFlags | SCH_ITEM::COMPARE_FLAGS::EQUALITY + | SCH_ITEM::COMPARE_FLAGS::SKIP_TST_POS ); if( retv ) return retv; @@ -1467,7 +1469,10 @@ int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const wxCHECK( tmp, -1 ); if( m_number != tmp->m_number ) - return m_number.Cmp( tmp->m_number ); + { + // StrNumCmp: sort the same as the pads in the footprint file + return StrNumCmp( m_number, tmp->m_number ) < 0; + } if( m_position.x != tmp->m_position.x ) return m_position.x - tmp->m_position.x;