Fix symbol fields sorting.

In the symbol fields table the reference contains only the letter, so
the number must be appended.  Conversely, we don't want the unit suffix
as all units are folded into a single symbol.

Fixes https://gitlab.com/kicad/code/kicad/issues/9238
This commit is contained in:
Jeff Young 2021-09-25 21:14:42 +01:00
parent 6b25099df7
commit c9aebb8529
1 changed files with 4 additions and 4 deletions

View File

@ -301,8 +301,8 @@ public:
std::sort( references.begin(), references.end(), std::sort( references.begin(), references.end(),
[]( const SCH_REFERENCE& l, const SCH_REFERENCE& r ) -> bool []( const SCH_REFERENCE& l, const SCH_REFERENCE& r ) -> bool
{ {
wxString l_ref( l.GetFullRef() ); wxString l_ref( l.GetRef() << l.GetRefNumber() );
wxString r_ref( r.GetFullRef() ); wxString r_ref( r.GetRef() << r.GetRefNumber() );
return StrNumCmp( l_ref, r_ref, true ) < 0; return StrNumCmp( l_ref, r_ref, true ) < 0;
} ); } );
@ -371,8 +371,8 @@ public:
if( lhs == rhs || sortCol == REFERENCE_FIELD ) if( lhs == rhs || sortCol == REFERENCE_FIELD )
{ {
wxString lhRef = lhGroup.m_Refs[ 0 ].GetFullRef(); wxString lhRef = lhGroup.m_Refs[ 0 ].GetRef() + lhGroup.m_Refs[ 0 ].GetRefNumber();
wxString rhRef = rhGroup.m_Refs[ 0 ].GetFullRef(); wxString rhRef = rhGroup.m_Refs[ 0 ].GetRef() + rhGroup.m_Refs[ 0 ].GetRefNumber();
return local_cmp( StrNumCmp( lhRef, rhRef, true ), 0 ); return local_cmp( StrNumCmp( lhRef, rhRef, true ), 0 );
} }
else else