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; return -1;
} }
//fprintf(stderr, "%08x %016lx %c %d %d\n", targ->gcluster, targ->channels, cell_double_wide_p(targ) ? 'D' : 'd', bytes, cols); //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 // must set our right hand sides wide, and check for further damage
nccell* candidate = &n->fb[nfbcellidx(n, n->y, n->x + 1)]; ++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)){ 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); cell_release(n, candidate);
candidate->channels = targ->channels; candidate->channels = targ->channels;
candidate->stylemask = targ->stylemask; candidate->stylemask = targ->stylemask;
++n->x;
} }
n->x += cols;
return cols; return cols;
} }

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

Loading…
Cancel
Save