mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
sixel: fix image deletion issue (#150)
This fixes the current implementation, which does not delete an image if an application first erases the image and then spawns a new transparent image in its place. The reason it didn't work before was because the two operations were handled at different stages in the rendering pipeline.
This commit is contained in:
parent
5d2d1d818c
commit
aaaa59eb77
34
st.c
34
st.c
@ -2603,8 +2603,8 @@ strhandle(void)
|
|||||||
{ defaultcs, "cursor" }
|
{ defaultcs, "cursor" }
|
||||||
};
|
};
|
||||||
#if SIXEL_PATCH
|
#if SIXEL_PATCH
|
||||||
ImageList *im, *newimages, *next, *tail;
|
ImageList *im, *newimages, *next, *tail = NULL;
|
||||||
int i, x1, y1, x2, y2, numimages;
|
int i, x1, y1, x2, y2, y, numimages;
|
||||||
int cx, cy;
|
int cx, cy;
|
||||||
Line line;
|
Line line;
|
||||||
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
#if SCROLLBACK_PATCH || REFLOW_PATCH
|
||||||
@ -2729,16 +2729,34 @@ strhandle(void)
|
|||||||
y1 = newimages->y;
|
y1 = newimages->y;
|
||||||
x2 = x1 + newimages->cols;
|
x2 = x1 + newimages->cols;
|
||||||
y2 = y1 + numimages;
|
y2 = y1 + numimages;
|
||||||
if (newimages->transparent) {
|
/* Delete the old images that are covered by the new image(s). We also need
|
||||||
for (tail = term.images; tail && tail->next; tail = tail->next);
|
* to check if they have already been deleted before adding the new ones. */
|
||||||
} else {
|
if (term.images) {
|
||||||
for (tail = NULL, im = term.images; im; im = next) {
|
char transparent[numimages];
|
||||||
|
for (i = 0, im = newimages; im; im = im->next, i++) {
|
||||||
|
transparent[i] = im->transparent;
|
||||||
|
}
|
||||||
|
for (im = term.images; im; im = next) {
|
||||||
next = im->next;
|
next = im->next;
|
||||||
if (im->x >= x1 && im->x + im->cols <= x2 &&
|
if (im->y >= y1 && im->y < y2) {
|
||||||
im->y >= y1 && im->y <= y2) {
|
y = im->y - scr;
|
||||||
|
if (y >= 0 && y < term.row && term.dirty[y]) {
|
||||||
|
line = term.line[y];
|
||||||
|
j = MIN(im->x + im->cols, term.col);
|
||||||
|
for (i = im->x; i < j; i++) {
|
||||||
|
if (line[i].mode & ATTR_SIXEL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == j) {
|
||||||
delete_image(im);
|
delete_image(im);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (im->x >= x1 && im->x + im->cols <= x2 && !transparent[im->y - y1]) {
|
||||||
|
delete_image(im);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
tail = im;
|
tail = im;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user