From 605fa32d459e0ad299a64f4db86eefb60fa8d10f Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Thu, 18 Apr 2024 11:39:46 +0200 Subject: [PATCH] [CALC] Fix input bug when display is in error. (#5988) CORE-19191 Reproduce the same behaviour of the calculator for Windows XP when an error condition is met. When the result is NaN and it cannot be printed, the error condition is cleared by pressing the CLEAR button. --- base/applications/calc/winmain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/applications/calc/winmain.c b/base/applications/calc/winmain.c index 974216b6f14..b2ab16cd0e2 100644 --- a/base/applications/calc/winmain.c +++ b/base/applications/calc/winmain.c @@ -1635,7 +1635,7 @@ static INT_PTR CALLBACK DlgMainProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) case IDC_BUTTON_D: case IDC_BUTTON_E: case IDC_BUTTON_F: - calc.is_nan = FALSE; + if (calc.is_nan) break; build_operand(hWnd, LOWORD(wp)); return TRUE; case IDC_BUTTON_PERCENT: @@ -1701,6 +1701,7 @@ static INT_PTR CALLBACK DlgMainProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) } return TRUE; case IDC_BUTTON_BACK: + if (calc.is_nan) break; if (calc.sci_in) { if (calc.esp == 0) { TCHAR *ptr;