Escape symbols when adding to library

Can't escape by default because the allowed characters differ in the
read-only libraries and existing schematics that reference them.  So,
escape when we import into standard KiCad Libraries

Fixes https://gitlab.com/kicad/code/kicad/issues/9419
This commit is contained in:
Seth Hillbrand 2021-10-18 10:35:21 -07:00
parent 9b4c293f14
commit 512ba167e8
1 changed files with 4 additions and 2 deletions

View File

@ -91,7 +91,9 @@ void SYMBOL_EDIT_FRAME::ImportSymbol()
wxString symbolName = symbols[0];
LIB_SYMBOL* entry = pi->LoadSymbol( fn.GetFullPath(), symbolName );
if( m_libMgr->SymbolExists( symbols[0], libName ) )
entry->SetName( EscapeString( entry->GetName(), CTX_LIBID ) );
if( m_libMgr->SymbolExists( entry->GetName(), libName ) )
{
msg.Printf( _( "Symbol %s already exists in library '%s'." ), symbolName, libName );
@ -105,7 +107,7 @@ void SYMBOL_EDIT_FRAME::ImportSymbol()
m_libMgr->UpdateSymbol( entry, libName );
SyncLibraries( false );
LoadSymbol( symbolName, libName, 1 );
LoadSymbol( entry->GetName(), libName, 1 );
}