demo_getc_nblock() call in demo_render() #509

This commit is contained in:
nick black 2020-04-18 19:11:18 -04:00
parent 67100dc5e9
commit 10643980fa
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -420,6 +420,7 @@ int demo_nanosleep(struct notcurses* nc, const struct timespec *ts){
return 0; return 0;
} }
// FIXME needs to pass back any ncinput read, if requested...hrmmm
int demo_render(struct notcurses* nc){ int demo_render(struct notcurses* nc){
if(interrupted){ if(interrupted){
return 1; return 1;
@ -450,5 +451,15 @@ int demo_render(struct notcurses* nc){
return -1; return -1;
} }
} }
return notcurses_render(nc); ncinput ni;
char32_t id;
id = demo_getc_nblock(nc, &ni);
int ret = notcurses_render(nc);
if(ret){
return ret;
}
if(id == 'q'){
return 1;
}
return 0;
} }