[shutdown] send XTMODKEYSUNDO if we don't have a kitty keyboard level

This commit is contained in:
nick black 2021-11-01 22:27:42 -05:00
parent 2be84dd3e8
commit 479396c625
4 changed files with 18 additions and 10 deletions

View File

@ -42,10 +42,10 @@ yielder(struct marsh* m){
pthread_cond_wait(&cond, &lock);
}
while(*m->filled < threshold_painted && iters < MAXITER && !*m->done){
//fprintf(stderr, "%d/%d tfilled: %d thresh: %ld total: %d\n", m->maxy, m->maxx, *m->filled, threshold_painted, m->maxy * m->maxx);
int pfilled = 0;
// the first time the first thread runs, it does not pick up the previous
// polyfill origin (as there was none). all other runs, we do.
// polyfill origin (as there was none). all other runs, we do. fill in our
// own copy with the other thread's move.
if(iters || m->id){
ncvisual_polyfill_yx(m->ncv, *m->polyy, *m->polyx, *m->polypixel);
}

View File

@ -101,12 +101,16 @@ notcurses_stop_minimal(void* vnc){
ret |= tcsetattr(nc->tcache.ttyfd, TCSAFLUSH, nc->tcache.tpreserved);
}
// don't use use leave_alternate_screen() here; we need pop the keyboard
// whether we're in regular or altnerate screen, and we need it done
// whether we're in regular or alternate screen, and we need it done
// before returning to the regular screen if we're in the alternate.
if(nc->tcache.kbdlevel){
if(tty_emit(KKEYBOARD_POP, nc->tcache.ttyfd)){
ret = -1;
}
}else{
if(tty_emit(XTMODKEYSUNDO, nc->tcache.ttyfd)){
ret = -1;
}
}
if(nc->tcache.in_alt_screen){
if((esc = get_escape(&nc->tcache, ESCAPE_RMCUP))){

View File

@ -341,11 +341,6 @@ init_terminfo_esc(tinfo* ti, const char* name, escape_e idx,
// supported. these ought follow keyboard push and precede kitty keyboard.
#define XTMODKEYS "\x1b[>2;1m\x1b[>4;1m"
// disable key modifier options; this corresponds to a resource value of
// "-1", which cannot be set with the [>m sequence. supposedly, "[>m" by
// itself ought reset all of them, but this doesn't seem to work FIXME.
#define XTMODKEYSUNDO "\x1b[>2n\x1b[>4n"
// these queries can hopefully uniquely and unquestionably identify the
// terminal to which we are talking. if we already know what we're talking
// to, there's no point in sending them.
@ -395,10 +390,12 @@ init_terminfo_esc(tinfo* ti, const char* name, escape_e idx,
GEOMCELL \
PRIDEVATTR
// kitty keyboard push, used at start
#define KKEYBOARD_PUSH "\x1b[>u"
// written whenever we switch between standard and alternate screen, or upon
// startup (that's an entry into a screen! presumably the standard one).
#define KBDENTER KKEYBOARD_PUSH XTMODKEYS KBDSUPPORT
#define KBDLEAVE KKEYBOARD_POP XTMODKEYSUNDO
// enter the alternate screen (smcup). we could technically get this from
// terminfo, but everyone who supports it supports it the same way, and we

View File

@ -16,8 +16,15 @@ extern "C" {
#include "fbuf.h"
#include "in.h"
// kitty keyboard protocol pop, used at end
#define KKEYBOARD_POP "\x1b[<u"
#define KKEYBOARD_PUSH "\x1b[>u"
// disable key modifier options; this corresponds to a resource value of
// "-1", which cannot be set with the [>m sequence. supposedly, "[>m" by
// itself ought reset all of them, but this doesn't seem to work FIXME.
#define XTMODKEYSUNDO "\x1b[>2n\x1b[>4n"
#define KBDLEAVE KKEYBOARD_POP XTMODKEYSUNDO
struct ncpile;
struct sprixel;