From e0e747837e95b90a30f722c3440f8394bc7ce6de Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 8 May 2021 17:13:59 -0400 Subject: [PATCH] kitty: must damage cells underneath a sprixel when hiding #1562 --- src/lib/kitty.c | 6 ++---- src/lib/sixel.c | 1 + src/lib/sprite.c | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/kitty.c b/src/lib/kitty.c index 523125884..6d9e24354 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -581,18 +581,16 @@ int kitty_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){ sprixcell_e state = sprixel_state(s, yy - s->movedfromy + s->n->absy - stdn->absy, xx - s->movedfromx + s->n->absx - stdn->absx); if(state == SPRIXCELL_OPAQUE_KITTY){ -//fprintf(stderr, "DAMAGED 1\n"); r->s.damaged = 1; }else if(s->invalidated == SPRIXEL_MOVED){ // ideally, we wouldn't damage our annihilated sprixcells, but if // we're being annihilated only during this cycle, we need to go // ahead and damage it. -//fprintf(stderr, "DAMAGED 2\n"); r->s.damaged = 1; } }else{ -//fprintf(stderr, "DAMAGED 3\n"); - //r->s.damaged = 1; + // need this to damage cells underneath a sprixel we're removing + r->s.damaged = 1; } } } diff --git a/src/lib/sixel.c b/src/lib/sixel.c index 9112402e5..778339063 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -696,6 +696,7 @@ int sixel_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s){ 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]; + // FIXME this probably overdoes it -- look at kitty_destroy() if(!r->sprixel){ r->s.damaged = 1; } diff --git a/src/lib/sprite.c b/src/lib/sprite.c index b6f1af494..1539e5afc 100644 --- a/src/lib/sprite.c +++ b/src/lib/sprite.c @@ -82,16 +82,17 @@ void sprixel_movefrom(sprixel* s, int y, int x){ void sprixel_hide(sprixel* s){ if(ncplane_pile(s->n) == NULL){ // ncdirect case; destroy now +//fprintf(stderr, "HIDING %d IMMEDIATELY\n", s->id); sprixel_free(s); return; } // otherwise, it'll be killed in the next rendering cycle. - // guard so that a double call doesn't drop core on /s->n->sprite if(s->invalidated != SPRIXEL_HIDE){ //fprintf(stderr, "HIDING %d\n", s->id); s->invalidated = SPRIXEL_HIDE; s->movedfromy = ncplane_abs_y(s->n); s->movedfromx = ncplane_abs_x(s->n); + // guard; might have already been replaced if(s->n){ s->n->sprite = NULL; s->n = NULL;