mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
[cli1] properly loop on NCTYPE_RELEASE
This commit is contained in:
parent
0836f02864
commit
3eb2383fff
@ -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);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user