lib symbols: make fp filter tolerant to spaces in names.
For historical reasons they are stored in a string using spaces as separators. So each fp filter is now escaped to remove spaces (replaced by {space}) Fixes #9009 https://gitlab.com/kicad/code/kicad/issues/9009
This commit is contained in:
parent
9f22baf109
commit
4ac2aa675a
|
@ -211,6 +211,15 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
|||
else
|
||||
converted += c;
|
||||
}
|
||||
else if( aContext == CTX_NO_SPACE )
|
||||
{
|
||||
if( c == ' ' )
|
||||
converted += "{space}";
|
||||
else if( c == '{' )
|
||||
converted += "{brace}";
|
||||
else
|
||||
converted += c;
|
||||
}
|
||||
else
|
||||
converted += c;
|
||||
}
|
||||
|
|
|
@ -851,7 +851,10 @@ LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>& aSymbol
|
|||
wxStringTokenizer tokenizer( value );
|
||||
|
||||
while( tokenizer.HasMoreTokens() )
|
||||
filters.Add( tokenizer.GetNextToken() );
|
||||
{
|
||||
wxString curr_token = UnescapeString( tokenizer.GetNextToken() );
|
||||
filters.Add( curr_token );
|
||||
}
|
||||
|
||||
aSymbol->SetFPFilters( filters );
|
||||
return nullptr;
|
||||
|
|
|
@ -1750,10 +1750,13 @@ void SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields( LIB_SYMBOL* aSymbol, OUTPUTFOR
|
|||
|
||||
for( auto filter : fpFilters )
|
||||
{
|
||||
// Spaces are not handled in fp filter names so escape spaces if any
|
||||
wxString curr_filter = EscapeString( filter, ESCAPE_CONTEXT::CTX_NO_SPACE );
|
||||
|
||||
if( tmp.IsEmpty() )
|
||||
tmp = filter;
|
||||
tmp = curr_filter;
|
||||
else
|
||||
tmp += " " + filter;
|
||||
tmp += " " + curr_filter;
|
||||
}
|
||||
|
||||
LIB_FIELD description( -1, wxString( "ki_fp_filters" ) );
|
||||
|
|
|
@ -55,7 +55,8 @@ enum ESCAPE_CONTEXT
|
|||
CTX_LIBID,
|
||||
CTX_QUOTED_STR,
|
||||
CTX_LINE,
|
||||
CTX_FILENAME
|
||||
CTX_FILENAME,
|
||||
CTX_NO_SPACE // to replace spaces in names that do not accept spaces
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue