diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 759685b697..969dbd6e88 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1340,13 +1340,20 @@ BITMAPS LIB_PIN::GetMenuImage() const wxString LIB_PIN::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const { + // This code previously checked "m_name.IsEmpty()" to choose the correct + // formatting path, but that check fails if the pin is called "~" which is + // the default for an empty pin name. Instead we get the final display string + // that will be shown and check if it's empty. + + wxString shownName = UnescapeString( GetShownName() ); + if( IsVisible() ) { - if( !m_name.IsEmpty() ) + if ( !shownName.IsEmpty() ) { return wxString::Format( _( "Pin %s [%s, %s, %s]" ), GetShownNumber(), - UnescapeString( GetShownName() ), + shownName, GetElectricalTypeName(), PinShapeGetText( m_shape ) ); } @@ -1360,11 +1367,11 @@ wxString LIB_PIN::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const } else { - if( !m_name.IsEmpty() ) + if( !shownName.IsEmpty() ) { return wxString::Format( _( "Hidden pin %s [%s, %s, %s]" ), GetShownNumber(), - UnescapeString( GetShownName() ), + shownName, GetElectricalTypeName(), PinShapeGetText( m_shape ) ); }