mojibake: clean up topmost line of display #842

pull/848/head
nick black 4 years ago committed by Nick Black
parent c1c1238e7e
commit 886255e941

@ -186,6 +186,7 @@ ext_demos(struct notcurses* nc, const char* spec, bool ignore_failures){
if(ret && !ignore_failures){
break;
}
notcurses_refresh(nc, NULL, NULL);
}
return results;
}

@ -3699,18 +3699,23 @@ int mojibake_demo(struct notcurses* nc){
do{
unsigned u = topmost;
do{
int y, x, leny;
int y, x, leny, lenx;
ncplane_yx(planes[u], &y, &x);
if(y >= dimy){
break;
}
if(ncplane_move_yx(planes[u], y - 1, x)){
ncplane_dim_yx(planes[u], &leny, &lenx);
if(y == 1){
if(leny > 1){
if(ncplane_resize(planes[u], 1, 0, leny - 1, lenx, -1, 0, leny - 1, lenx)){
goto err;
}
}else{
++topmost;
}
}else if(ncplane_move_yx(planes[u], y - 1, x)){
goto err;
}
ncplane_dim_yx(planes[u], &leny, NULL);
if(leny + y + 1 == 0){
++topmost;
}
if(leny + y + 1 == dimy - 1){
if(u + 1 < sizeof(planes) / sizeof(*planes)){
if(ncplane_move_yx(planes[u + 1], dimy - 1, x)){

@ -490,8 +490,8 @@ int ncplane_resize_internal(ncplane* n, int keepy, int keepx, int keepleny,
n->nc->stats.fbbytes -= sizeof(*preserved) * (rows * cols);
n->nc->stats.fbbytes += fbsize;
n->fb = fb;
n->absy = n->absy + keepy - yoff;
n->absx = n->absx + keepx - xoff;
n->absy += keepy + yoff;
n->absx += keepx + xoff;
// if we're keeping nothing, dump the old egcspool. otherwise, we go ahead
// and keep it. perhaps we ought compact it?
if(keptarea == 0){ // keep nothing, resize/move only

Loading…
Cancel
Save