Clear screen if we want smcup but it's not available #817

pull/820/head
nick black 4 years ago
parent 0bd73e2f1f
commit 6d2ba86acc
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -322,8 +322,6 @@ int main(void){
if(!nc.mouse_enable()){
return EXIT_FAILURE;
}
// clear the screen in the absence of smcup mode
nc.refresh(nullptr, nullptr);
int ret = input_demo(&nc);
if(!nc.stop() || ret){
return EXIT_FAILURE;

@ -922,9 +922,18 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
init_banner(ret);
// flush on the switch to alternate screen, lest initial output be swept away
if(ret->ttyfd >= 0){
if(ret->tcache.smcup && tty_emit("smcup", ret->tcache.smcup, ret->ttyfd)){
free_plane(ret->top);
goto err;
if(ret->tcache.smcup){
if(tty_emit("smcup", ret->tcache.smcup, ret->ttyfd)){
free_plane(ret->top);
goto err;
}
}else{
// if they expected the alternate screen, but we didn't have one to
// offer, at least clear the screen. try using "clear"; if that doesn't
// fly, use notcurses_refresh() to force a clearing via iterated writes.
if(tty_emit("clear", ret->tcache.clearscr, ret->ttyfd)){
notcurses_refresh(ret, NULL, NULL);
}
}
}
return ret;

@ -35,7 +35,6 @@ int main(void) {
ncopts.flags = NCOPTION_INHIBIT_SETLOCALE;
ncpp::NotCurses nc(ncopts);
{
nc.refresh(nullptr, nullptr); // clear screen if smcup+background are unavailable
Tetris t{nc, gameover};
std::thread tid(&Tetris::Ticker, &t);
if(IOLoop(nc, t, gameover)){

Loading…
Cancel
Save