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

(cherry picked from commit a9eb7a0e28)
(cherry picked from commit 02252be29d)
This commit is contained in:
Jeff Young
2022-03-18 12:49:32 -07:00
committed by Seth Hillbrand
parent f058dc9ed8
commit 02b1f552fd
3 changed files with 14 additions and 4 deletions
+12 -2
View File
@@ -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 += wxT( "{brace}" );
else if( c == '/' )
converted += wxT( "{slash}" );
@@ -227,7 +235,9 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
converted += c;
}
else
{
converted += c;
}
}
return converted;