[shutdown] ensure kitty pop goes to tty

In notcurses_stop_minimal(), we need to send most of
our resets prior to sending rmcup. rmcup and the kitty
pop, furthermore, need to be going to the ttyfd to match
their opposites. They were previously going to stdout,
meaning the kitty pop wasn't acted on when we redirected
stdout. Closes #2149.
pull/2159/head
nick black 3 years ago
parent b74b23ad7c
commit 36825374b9
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -92,34 +92,35 @@ notcurses_stop_minimal(void* vnc){
}
ret |= mouse_disable(&nc->tcache, f);
ret |= reset_term_attributes(&nc->tcache, f);
if(nc->tcache.kittykbd){
if(fbuf_emit(f, "\x1b[<u")){
ret = -1;
}
if((esc = get_escape(&nc->tcache, ESCAPE_RMKX)) && fbuf_emit(f, esc)){
ret = -1;
}
const char* cnorm = get_escape(&nc->tcache, ESCAPE_CNORM);
if(cnorm && fbuf_emit(f, cnorm)){
ret = -1;
}
if(blocking_write(fileno(nc->ttyfp), f->buf, f->used)){
ret = -1;
}
fbuf_reset(f);
if(nc->tcache.ttyfd >= 0){
if(nc->tcache.tpreserved){
ret |= tcsetattr(nc->tcache.ttyfd, TCSAFLUSH, nc->tcache.tpreserved);
}
if(nc->tcache.kittykbd){
if(tty_emit("\x1b[<u", nc->tcache.ttyfd)){
ret = -1;
}
}
if((esc = get_escape(&nc->tcache, ESCAPE_RMCUP))){
if(sprite_clear_all(&nc->tcache, f)){
if(sprite_clear_all(&nc->tcache, f)){ // send this to f
ret = -1;
}
if(fbuf_emit(f, esc)){
if(tty_emit(esc, nc->tcache.ttyfd)){ // but this goes to ttyfd
ret = -1;
}
}
}
if((esc = get_escape(&nc->tcache, ESCAPE_RMKX)) && fbuf_emit(f, esc)){
ret = -1;
}
const char* cnorm = get_escape(&nc->tcache, ESCAPE_CNORM);
if(cnorm && fbuf_emit(f, cnorm)){
ret = -1;
}
if(blocking_write(fileno(nc->ttyfp), f->buf, f->used)){
ret = -1;
}
return ret;
}

Loading…
Cancel
Save