ncreel: properly size tablets in all border conditions #1031

pull/1035/head
nick black 4 years ago committed by Nick Black
parent c236b65266
commit f15dc9ba80

@ -83,7 +83,7 @@ tabletdraw(struct ncplane* w, int maxy, tabletctx* tctx, unsigned rgb){
}
cell_release(w, &c);
}
return y - 1;
return y;
}
static int

@ -276,9 +276,10 @@ ncreel_draw_tablet(const ncreel* nr, nctablet* t, int frontiertop,
++cbx;
}
if(cbleny - cby + 1 > 0){
t->cbp = ncplane_new(t->p, cbleny - cby + 1, cblenx - cbx + 1, cby, cbx, NULL, "tdat");
//fprintf(stderr, "CREATING %dx%d\n", cbleny, cblenx);
t->cbp = ncplane_new(t->p, cbleny, cblenx, cby, cbx, NULL, "tdat");
if(t->cbp == NULL){
//fprintf(stderr, "failure creating data plane %d %d %d %d\n", cbleny - cby + 1, cblenx - cbx + 1, cby, cbx);
//fprintf(stderr, "failure creating data plane %d %d %d %d\n", cbleny, cblenx, cby, cbx);
ncplane_destroy(t->p);
t->p = NULL;
return -1;

@ -73,7 +73,7 @@ int check_allborders(nctablet* t, bool drawfromtop) {
ncplane_dim_yx(ncp, &rows, &cols);
int srows, scols;
ncplane_dim_yx(notcurses_stdplane(ncplane_notcurses(ncp)), &srows, &scols);
CHECK(srows == rows + 4);
CHECK(srows == rows + 2);
CHECK(scols == cols + 4);
return 1;
}
@ -99,7 +99,7 @@ int check_notborders(nctablet* t, bool drawfromtop) {
ncplane_dim_yx(ncp, &rows, &cols);
int srows, scols;
ncplane_dim_yx(notcurses_stdplane(ncplane_notcurses(ncp)), &srows, &scols);
CHECK(srows == rows + 2);
CHECK(srows == rows); // we get maximum possible size to try out
CHECK(scols == cols + 2);
return 1;
}

Loading…
Cancel
Save