Skip to content

Commit

Permalink
account for margins in sixel/kitty_destroy() #1588
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed May 9, 2021
1 parent dc9db79 commit 19006b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/kitty.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,13 @@ int kitty_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
return -1;
}
//fprintf(stderr, "FROM: %d/%d state: %d s->n: %p\n", s->movedfromy, s->movedfromx, s->invalidated, s->n);
const ncplane* stdn = notcurses_stdplane_const(nc);
for(int yy = s->movedfromy ; yy < s->movedfromy + s->dimy && yy < p->dimy ; ++yy){
for(int xx = s->movedfromx ; xx < s->movedfromx + s->dimx && xx < p->dimx ; ++xx){
struct crender *r = &p->crender[yy * p->dimx + xx];
const int ridx = (yy - stdn->absy) * p->dimx + (xx - stdn->absx);
struct crender *r = &p->crender[ridx];
if(!r->sprixel){
if(s->n){
const ncplane* stdn = notcurses_stdplane_const(nc);
//fprintf(stderr, "CHECKING %d/%d\n", yy - s->movedfromy, xx - s->movedfromx);
sprixcell_e state = sprixel_state(s, yy - s->movedfromy + s->n->absy - stdn->absy,
xx - s->movedfromx + s->n->absx - stdn->absx);
Expand Down
4 changes: 3 additions & 1 deletion src/lib/sixel.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,11 @@ int sixel_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){
(void)out;
int starty = s->movedfromy;
int startx = s->movedfromx;
const ncplane* stdn = notcurses_stdplane_const(nc);
for(int yy = starty ; yy < starty + s->dimy && yy < p->dimy ; ++yy){
for(int xx = startx ; xx < startx + s->dimx && xx < p->dimx ; ++xx){
struct crender *r = &p->crender[yy * p->dimx + xx];
int ridx = (yy - stdn->absy) * p->dimx + (xx - stdn->absx);
struct crender *r = &p->crender[ridx];
// FIXME this probably overdoes it -- look at kitty_destroy()
if(!r->sprixel){
r->s.damaged = 1;
Expand Down

0 comments on commit 19006b4

Please sign in to comment.