Check value-follows-name case in symbol Save As.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15647
This commit is contained in:
Jeff Young 2023-09-14 23:54:04 +01:00
parent 862567b21a
commit 849a4656c8
1 changed files with 4 additions and 0 deletions

View File

@ -663,6 +663,7 @@ void SYMBOL_EDIT_FRAME::saveSymbolAs()
LIB_ID old_lib_id = symbol->GetLibId();
wxString symbolName = old_lib_id.GetLibItemName();
wxString libraryName = old_lib_id.GetLibNickname();
bool valueFollowsName = symbol->GetValueField().GetText() == symbolName;
wxString msg;
bool done = false;
@ -730,6 +731,9 @@ void SYMBOL_EDIT_FRAME::saveSymbolAs()
LIB_SYMBOL new_symbol( *symbol );
new_symbol.SetName( symbolName );
if( valueFollowsName )
new_symbol.GetValueField().SetText( symbolName );
m_libMgr->UpdateSymbol( &new_symbol, libraryName );
SyncLibraries( false );
m_treePane->GetLibTree()->SelectLibId( LIB_ID( libraryName, new_symbol.GetName() ) );