When presented with empty text we don't want to Normalize() the SIM_VALUE.
But we *do* need to update NUMERICAL_EVALUATOR::m_originalText by
calling NUMERICAL_EVALUATOR::Process().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15871
(cherry picked from commit 6b29c346b9
)
This commit is contained in:
parent
20ada81d43
commit
c7c28c0471
|
@ -187,17 +187,20 @@ bool SIM_STRING_PROPERTY::StringToValue( wxVariant& aVariant, const wxString& aT
|
|||
|
||||
wxString text = aText;
|
||||
|
||||
if( !aText.IsEmpty() && allowEval() && m_needsEval && m_eval.Process( aText ) )
|
||||
if( allowEval() && m_needsEval && m_eval.Process( aText ) )
|
||||
{
|
||||
double value = SIM_VALUE::ToDouble( m_eval.Result().ToStdString() );
|
||||
if( !aText.IsEmpty() )
|
||||
{
|
||||
double value = SIM_VALUE::ToDouble( m_eval.Result().ToStdString() );
|
||||
|
||||
if( isnan( value ) || SIM_VALUE::Equal( value, aText.ToStdString() ) )
|
||||
{
|
||||
// Don't mess up user formatting if eval'ing didn't actually change the value.
|
||||
}
|
||||
else
|
||||
{
|
||||
text = SIM_VALUE::Normalize( value );
|
||||
if( std::isnan( value ) || SIM_VALUE::Equal( value, aText.ToStdString() ) )
|
||||
{
|
||||
// Don't mess up user formatting if eval'ing didn't actually change the value.
|
||||
}
|
||||
else
|
||||
{
|
||||
text = SIM_VALUE::Normalize( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue