Make sure LIB_ID escape context allows for formatting constructs.
Also make sure that value field is updated from name changes when the symbol is a power symbol (even if it's from the schematic instead of the library). Fixes https://gitlab.com/kicad/code/kicad/issues/11093
This commit is contained in:
+12
-2
@@ -142,7 +142,15 @@ bool ConvertSmartQuotesAndDashes( wxString* aString )
|
||||
|
||||
wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
||||
{
|
||||
wxString converted;
|
||||
wxString converted;
|
||||
std::vector<bool> braceStack; // true == formatting construct
|
||||
|
||||
auto hasFormattingPrefix =
|
||||
[&]()
|
||||
{
|
||||
static wxString prefixes = wxT( "~_^" );
|
||||
return !converted.IsEmpty() && prefixes.Find( converted.Last() ) >= 0;
|
||||
};
|
||||
|
||||
converted.reserve( aSource.length() );
|
||||
|
||||
@@ -159,7 +167,7 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
||||
}
|
||||
else if( aContext == CTX_LIBID )
|
||||
{
|
||||
if( c == '{' )
|
||||
if( c == '{' && !hasFormattingPrefix() )
|
||||
converted += "{brace}";
|
||||
else if( c == '/' )
|
||||
converted += "{slash}";
|
||||
@@ -238,7 +246,9 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
||||
converted += c;
|
||||
}
|
||||
else
|
||||
{
|
||||
converted += c;
|
||||
}
|
||||
}
|
||||
|
||||
return converted;
|
||||
|
||||
Reference in New Issue
Block a user