Use 'special' escaping for certain fields

Most fields are escaped using the `\` notation.  But the VALUE field and
the symbol name need to be escaped using braces notation.

Fixes https://gitlab.com/kicad/code/kicad/issues/10097
This commit is contained in:
Seth Hillbrand 2022-01-05 17:16:54 -08:00
parent b8a7a66a0a
commit 71e7b4b77b
1 changed files with 6 additions and 1 deletions

View File

@ -2727,7 +2727,6 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
aliasName = wxString::FromUTF8( line );
aliasName.Trim();
// aliasName = EscapeString( aliasName, CTX_LIBID );
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aliasName );
@ -2834,6 +2833,7 @@ LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorV
wxString name, prefix, tmp;
name = tokens.GetNextToken();
name = EscapeString( name, CTX_LIBID );
pos += name.size() + 1;
prefix = tokens.GetNextToken();
@ -3071,6 +3071,11 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_SYMBOL>& aSymbol,
parseQuotedString( text, aReader, line, &line, true );
// The value field needs to be "special" escaped. The other fields are
// escaped normally and don't need special handling
if( id == VALUE_FIELD )
text = EscapeString( text, CTX_QUOTED_STR );
// Doctor the *.lib file field which has a "~" in blank fields. New saves will
// not save like this.
if( text.size() == 1 && text[0] == '~' )