From 89153ca75a962db8f74a2dee6f91e491fae9bb44 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 16 Dec 2022 11:48:26 +0100 Subject: [PATCH] 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 --- eeschema/lib_symbol.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 99c0762eeb..adad526d67 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -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 // first letter is expected to be 'A' or 'a' (i.e. 26 letters are available) int u; + wxString suffix; do { u = ( aUnit - 1 ) % 26; - subRef = wxChar( m_subpartFirstId + u ) + subRef; + suffix = wxChar( m_subpartFirstId + u ) + suffix; aUnit = ( aUnit - u ) / 26; } while( aUnit > 0 ); + subRef << suffix; } return subRef;