When updating RefDes only update the prefix.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16991

(cherry picked from commit b6036f368e)
This commit is contained in:
Jeff Young 2024-02-18 21:43:27 +00:00 committed by Roberto Fernandez Bautista
parent 2cd9fbab9d
commit 17a37a55f0
1 changed files with 11 additions and 2 deletions

View File

@ -650,10 +650,19 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
{ {
if( i == REFERENCE_FIELD ) if( i == REFERENCE_FIELD )
{ {
wxString prefix = UTIL::GetRefDesPrefix( libField->GetText() );
for( const SCH_SHEET_PATH& instance : symbol_change_info.m_Instances ) for( const SCH_SHEET_PATH& instance : symbol_change_info.m_Instances )
{ {
symbol->SetRef( &instance, wxString ref = symbol->GetRef( &instance, true );
UTIL::GetRefDesUnannotated( libField->GetText() ) ); int number = UTIL::GetRefDesNumber( ref );
if( number >= 0 )
ref.Printf( wxS( "%s%d" ), prefix, number );
else
ref = UTIL::GetRefDesUnannotated( prefix );
symbol->SetRef( &instance, ref );
} }
} }
else if( i == VALUE_FIELD ) else if( i == VALUE_FIELD )