Eeschema: fix incorrect calculation of unit id in reference: U1.A was shown as U1A.

Fixes #13178
https://gitlab.com/kicad/code/kicad/issues/13178
This commit is contained in:
jean-pierre charras 2022-12-16 11:48:26 +01:00
parent 75a4de4744
commit 89153ca75a
1 changed files with 3 additions and 1 deletions

View File

@ -601,14 +601,16 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
// use one letter if letter = A .. Z or a ... z, and 2 letters otherwise // use one letter if letter = A .. Z or a ... z, and 2 letters otherwise
// first letter is expected to be 'A' or 'a' (i.e. 26 letters are available) // first letter is expected to be 'A' or 'a' (i.e. 26 letters are available)
int u; int u;
wxString suffix;
do do
{ {
u = ( aUnit - 1 ) % 26; u = ( aUnit - 1 ) % 26;
subRef = wxChar( m_subpartFirstId + u ) + subRef; suffix = wxChar( m_subpartFirstId + u ) + suffix;
aUnit = ( aUnit - u ) / 26; aUnit = ( aUnit - u ) / 26;
} while( aUnit > 0 ); } while( aUnit > 0 );
subRef << suffix;
} }
return subRef; return subRef;