From 14e0d1887808a3d8233dd14877bce7da2fe8ca12 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sat, 22 Jun 2024 16:18:21 +0900 Subject: Handle user input better in the main loop --- src/calculer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/calculer.c b/src/calculer.c index eab2bde..589724f 100644 --- a/src/calculer.c +++ b/src/calculer.c @@ -200,12 +200,19 @@ main(int argc, char *argv[]) disp->display_calc(x, y); void *measure_data = measure_before(); input = disp->read_input(); - if (input == INT_MAX) + if ((input == DISP_QUIT) || (input == DISP_ERR)) { - disp->destroy(); + destroy_disp(disp); fclose(logfile); exit(0); } +#ifndef NDEBUG + else if (input == DISP_RELOAD) + { + disp_reload(disp); + continue; + } +#endif measure_after(measure_data, input == res); disp->display_res(input == res, 0); } -- cgit v1.2.3