From 1f3f26d91ea5a8361d0ad5c17955c0bbc17f1c34 Mon Sep 17 00:00:00 2001 From: "(Tim) Efthimis Kritikos" Date: Mon, 5 Feb 2024 12:34:28 +0000 Subject: [PATCH] GUI: slight fix on input handling --- gui.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/gui.c b/gui.c index 8957ea6..da2f4d1 100644 --- a/gui.c +++ b/gui.c @@ -334,20 +334,31 @@ int update_gui(struct simdata_t *simdata){ int gui_continue_request(){ char inch; - if(((inch=getch())==ERR)&&CPU_STATE==SINGLE_STEPPING) - return 1; - switch(inch){ - case 'r': - if(CPU_STATE==RUNNING){ - CPU_STATE=SINGLE_STEPPING; - nodelay(stdscr, FALSE); - }else{ - CPU_STATE=RUNNING; - nodelay(stdscr, TRUE); - } - break; - case 'q': - return 2; + int release=0; + while(release==0){ + if(((inch=getch())==ERR)){ + if(CPU_STATE==SINGLE_STEPPING) + return 1; + else + release=1; + } + switch(inch){ + case 'r': + if(CPU_STATE==RUNNING){ + CPU_STATE=SINGLE_STEPPING; + nodelay(stdscr, FALSE); + }else{ + CPU_STATE=RUNNING; + nodelay(stdscr, TRUE); + } + break; + case 'q': + return 2; + case '\n': + release=1; + break; + default: + } } return 0; }