Do not allow trailing/leading whitespace in mandatory fields

Reference, Value, Footprint and Datasheet all reference elements that
should not use trailing/leading whitespace or similar hidden charaters.
Other fields may utilize leading/trailing whitespace for obscure
purposes but won't break functionality as they are display only
This commit is contained in:
Seth Hillbrand 2024-06-06 11:46:38 -07:00
parent edc7603d2a
commit 6dcb9bb664
1 changed files with 5 additions and 1 deletions

View File

@ -1154,7 +1154,11 @@ void SCH_FIELD::SetText( const wxString& aText )
if( m_isNamedVariable )
return;
EDA_TEXT::SetText( aText );
// Mandatory fields should not have leading or trailing whitespace.
if( IsMandatory() )
EDA_TEXT::SetText( aText.Strip( wxString::both ) );
else
EDA_TEXT::SetText( aText );
}