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

This commit is contained in:
nick black 2021-01-02 20:01:22 -05:00
parent 8285b131c6
commit 9dcbda54ef
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 21 additions and 15 deletions

View File

@ -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;
} }

View File

@ -402,7 +402,10 @@ 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 int width = targc->width;
for(int i = 1 ; i < width ; ++i){
const ncplane* tmpp = crender->p; const ncplane* tmpp = crender->p;
++crender; ++crender;
crender->p = tmpp; crender->p = tmpp;
@ -418,6 +421,7 @@ postpaint_cell(nccell* lastframe, int dimx, struct crender* crender,
} }
} }
} }
}
// iterate over the rendered frame, adjusting the foreground colors for any // iterate over the rendered frame, adjusting the foreground colors for any