From 6dcb9bb664bea350da08e8299fd520c8dadd6f7a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 6 Jun 2024 11:46:38 -0700 Subject: [PATCH] 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 --- eeschema/sch_field.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 19262508b9..951c16f129 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -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 ); }