postpaint_cell()/ncplane_putc(): handle EGCs of more than 2 columns #1273

pull/1279/head
nick black 4 years ago
parent 8285b131c6
commit 9dcbda54ef
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1593,16 +1593,18 @@ ncplane_put(ncplane* n, int y, int x, const char* egc, int cols,
return -1;
}
//fprintf(stderr, "%08x %016lx %c %d %d\n", targ->gcluster, targ->channels, cell_double_wide_p(targ) ? 'D' : 'd', bytes, cols);
if(cols > 1){ // must set our right wide, and check for further damage
nccell* candidate = &n->fb[nfbcellidx(n, n->y, n->x + 1)];
// must set our right hand sides wide, and check for further damage
++n->x;
for(int i = 1 ; i < cols ; ++i){
nccell* candidate = &n->fb[nfbcellidx(n, n->y, n->x)];
if(cell_wide_left_p(candidate)){
cell_obliterate(n, &n->fb[nfbcellidx(n, n->y, n->x + 2)]);
cell_obliterate(n, &n->fb[nfbcellidx(n, n->y, n->x + 1)]);
}
cell_release(n, candidate);
candidate->channels = targ->channels;
candidate->stylemask = targ->stylemask;
++n->x;
}
n->x += cols;
return cols;
}

@ -402,18 +402,22 @@ postpaint_cell(nccell* lastframe, int dimx, struct crender* crender,
nccell* prevcell = &lastframe[fbcellidx(y, dimx, x)];
if(cellcmp_and_dupfar(pool, prevcell, crender->p, targc) > 0){
crender->damaged = true;
assert(!cell_wide_right_p(targc));
if(cell_wide_left_p(targc)){
const ncplane* tmpp = crender->p;
++crender;
crender->p = tmpp;
++x;
++prevcell;
++targc;
targc->gcluster = 0;
targc->channels = crender[-1].c.channels;
targc->stylemask = crender[-1].c.stylemask;
if(cellcmp_and_dupfar(pool, prevcell, crender->p, targc) > 0){
crender->damaged = true;
const int width = targc->width;
for(int i = 1 ; i < width ; ++i){
const ncplane* tmpp = crender->p;
++crender;
crender->p = tmpp;
++x;
++prevcell;
++targc;
targc->gcluster = 0;
targc->channels = crender[-1].c.channels;
targc->stylemask = crender[-1].c.stylemask;
if(cellcmp_and_dupfar(pool, prevcell, crender->p, targc) > 0){
crender->damaged = true;
}
}
}
}

Loading…
Cancel
Save