GUI: slight fix on input handling

This commit is contained in:
(Tim) Efthimis Kritikos 2024-02-05 12:34:28 +00:00
parent 2d4c021130
commit 1f3f26d91e

39
gui.c
View File

@ -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;
}