[cli1] properly loop on NCTYPE_RELEASE

pull/2500/head
nick black 2 years ago
parent 0836f02864
commit 3eb2383fff
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -502,6 +502,8 @@ int main(int argc, const char** argv){
notcurses_stop(nc);
return EXIT_FAILURE;
}
ncplane_set_fg_alpha(stdn, NCALPHA_HIGHCONTRAST);
ncplane_set_fg_rgb(stdn, 0xffffff);
ncplane_set_scrolling(stdn, true);
tinfo_debug_caps(stdn, &nc->tcache, indent);
tinfo_debug_styles(nc, stdn, indent);

@ -17,23 +17,25 @@ int main(void){
ncplane_set_scrolling(stdn, true);
ncinput ni;
do{
if(ncplane_putstr(stdn, "press any key\n") < 0){
if(ncplane_putstr(stdn, "press any key, q to quit\n") < 0){
goto err;
}
if(notcurses_render(nc)){
goto err;
}
// just some pointless testing of notcurses_inputready_fd() here
do{
// just some pointless testing of notcurses_inputready_fd() here
#ifndef __MINGW32__
struct pollfd pfd = {
.fd = notcurses_inputready_fd(nc),
.events = POLLIN,
};
while(poll(&pfd, 1, -1) <= 0){
}
struct pollfd pfd = {
.fd = notcurses_inputready_fd(nc),
.events = POLLIN,
};
while(poll(&pfd, 1, -1) <= 0){
}
#endif
notcurses_get_blocking(nc, &ni);
}while(ni.evtype == NCTYPE_RELEASE || ni.id != 'q');
notcurses_get_blocking(nc, &ni);
}while(ni.evtype == NCTYPE_RELEASE);
}while(ni.id != 'q');
if(notcurses_render(nc)){
goto err;
}

Loading…
Cancel
Save