From 4b427b2d0c2445234b7cdfe06ebb45b2fb611023 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 25 Feb 2023 16:30:51 +0000 Subject: [PATCH] Add second instance of "don't mess up user formatting" fix. Fixes https://gitlab.com/kicad/code/kicad/issues/13989 --- eeschema/sim/sim_property.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/eeschema/sim/sim_property.cpp b/eeschema/sim/sim_property.cpp index 24df31f0c5..ab902c386b 100644 --- a/eeschema/sim/sim_property.cpp +++ b/eeschema/sim/sim_property.cpp @@ -112,7 +112,18 @@ bool SIM_STRING_PROPERTY::OnEvent( wxPropertyGrid* propgrid, wxWindow* wnd_prima if( textEntry && m_eval.Process( textEntry->GetValue() ) ) { - SetValueInEvent( m_eval.Result() ); + double value = SIM_VALUE::ToDouble( m_eval.Result().ToStdString() ); + + if( isnan( value ) + || value == SIM_VALUE::ToDouble( textEntry->GetValue().ToStdString() ) ) + { + // Don't mess up user formatting if eval'ing didn't actually change the value. + } + else + { + SetValueInEvent( m_eval.Result() ); + } + m_needsEval = false; return true; }