always obliterate query spillage #2019

pull/1978/head
nick black 3 years ago
parent c7738c7d25
commit 57ebf73e72
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -864,11 +864,21 @@ ncdirect* ncdirect_core_init(const char* termtype, FILE* outfp, uint64_t flags){
goto err;
}
shortname_term = termname();
int cursor_y = -1;
int cursor_x = -1;
if(interrogate_terminfo(&ret->tcache, ret->ctermfd, shortname_term, utf8,
1, flags & NCDIRECT_OPTION_INHIBIT_CBREAK,
TERMINAL_UNKNOWN, NULL, NULL, NULL)){
TERMINAL_UNKNOWN, &cursor_y, &cursor_x, NULL)){
goto err;
}
if(cursor_y >= 0){
// the u7 led the queries so that we would get a cursor position
// unaffected by any query spill (unconsumed control sequences). move
// us back to that location, in case there was any such spillage.
if(ncdirect_cursor_move_yx(ret, cursor_y, cursor_x)){
goto err;
}
}
if(ncvisual_init(loglevel)){
goto err;
}

@ -1136,20 +1136,25 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){
const char* shortname_term = termname(); // longname() is also available
ret->rstate.logendy = -1;
ret->rstate.logendx = -1;
ret->rstate.x = ret->rstate.y = -1;
ret->suppress_banner = opts->flags & NCOPTION_SUPPRESS_BANNERS;
int fakecursory, fakecursorx;
int* cursory = opts->flags & NCOPTION_PRESERVE_CURSOR ?
&ret->rstate.logendy : &fakecursory;
int* cursorx = opts->flags & NCOPTION_PRESERVE_CURSOR ?
&ret->rstate.logendx : &fakecursorx;
if(interrogate_terminfo(&ret->tcache, ret->ttyfd, shortname_term, utf8,
opts->flags & NCOPTION_NO_ALTERNATE_SCREEN, 0,
opts->flags & NCOPTION_NO_FONT_CHANGES,
opts->flags & NCOPTION_PRESERVE_CURSOR ? &ret->rstate.logendy : NULL,
opts->flags & NCOPTION_PRESERVE_CURSOR ? &ret->rstate.logendx : NULL,
&ret->stats)){
cursory, cursorx, &ret->stats)){
goto err;
}
ret->rstate.x = ret->rstate.y = -1;
if(opts->flags & NCOPTION_PRESERVE_CURSOR){
if((opts->flags & NCOPTION_PRESERVE_CURSOR) || !ret->suppress_banner){
// the u7 led the queries so that we would get a cursor position
// unaffected by any query spill (unconsumed control sequences). move
// us back to that location, in case there was any such spillage.
if(goto_location(ret, ret->ttyfp, ret->rstate.logendy, ret->rstate.logendx)){
if(goto_location(ret, ret->ttyfp, *cursory, *cursorx)){
goto err;
}
}
int dimy, dimx;
@ -1157,7 +1162,6 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){
ret->margin_b)){
goto err;
}
ret->suppress_banner = opts->flags & NCOPTION_SUPPRESS_BANNERS;
if(ncvisual_init(ret->loglevel)){
goto err;
}

Loading…
Cancel
Save