From f660ec7cf8c739722841b560dc25a68d86bbbeab Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 30 Oct 2018 22:56:52 +0000 Subject: [PATCH] Eval when needed, but only replace text when killing focus. Fixes: lp:1800718 * https://bugs.launchpad.net/kicad/+bug/1800718 Fixes: lp:1800476 * https://bugs.launchpad.net/kicad/+bug/1800476 --- common/widgets/unit_binder.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/common/widgets/unit_binder.cpp b/common/widgets/unit_binder.cpp index b9f75956c2..df938decdf 100644 --- a/common/widgets/unit_binder.cpp +++ b/common/widgets/unit_binder.cpp @@ -227,21 +227,21 @@ int UNIT_BINDER::GetValue() { auto textEntry = dynamic_cast( m_value ); auto staticText = dynamic_cast( m_value ); - - if( m_needsEval && textEntry ) - { - if( m_eval.Process( textEntry->GetValue() ) ) - textEntry->ChangeValue( m_eval.Result() ); - - m_needsEval = false; - } + wxString value; if( textEntry ) - return ValueFromString( m_units, textEntry->GetValue(), m_useMils ); + { + if( m_needsEval && m_eval.Process( textEntry->GetValue() ) ) + value = m_eval.Result(); + else + value = textEntry->GetValue(); + } else if( staticText ) - return ValueFromString( m_units, staticText->GetLabel(), m_useMils ); + value = staticText->GetLabel(); else return 0; + + return ValueFromString( m_units, value, m_useMils ); }