[cli1] properly loop on NCTYPE_RELEASE

This commit is contained in:
nick black 2021-12-23 05:55:02 -05:00
parent 0836f02864
commit 3eb2383fff
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 14 additions and 10 deletions

View File

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

View File

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