diff --git a/common/string_utils.cpp b/common/string_utils.cpp index a8f17bc183..552a228e08 100644 --- a/common/string_utils.cpp +++ b/common/string_utils.cpp @@ -142,7 +142,15 @@ bool ConvertSmartQuotesAndDashes( wxString* aString ) wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) { - wxString converted; + wxString converted; + std::vector 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; diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index 2f20ed2621..42b15e9f58 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -448,7 +448,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnGridCellChanging( wxGridEvent& event ) void DIALOG_LIB_SYMBOL_PROPERTIES::OnSymbolNameText( wxCommandEvent& event ) { - if( !m_Parent->IsSymbolFromSchematic() ) + if( !m_Parent->IsSymbolFromSchematic() || m_OptionPower->IsChecked() ) m_grid->SetCellValue( VALUE_FIELD, FDC_VALUE, m_SymbolNameCtrl->GetValue() ); } diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index 9c5f95471e..9dee31f719 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -502,7 +502,7 @@ void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue value = fn.GetFullPath(); } } - else if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) && aRow == VALUE_FIELD ) + else if( m_parentType == SCH_SYMBOL_T && aRow == VALUE_FIELD ) { value = EscapeString( value, CTX_LIBID ); }