diff --git a/st.c b/st.c index ec01dc7..a351efe 100644 --- a/st.c +++ b/st.c @@ -2297,6 +2297,12 @@ csihandle(void) } #endif // SIXEL_PATCH break; + #if SIXEL_PATCH + case 6: /* sixels */ + for (im = term.images; im; im = im->next) + im->should_delete = 1; + break; + #endif // SIXEL_PATCH default: goto unknown; } @@ -2658,10 +2664,10 @@ strhandle(void) } for (i = 0; i < (sixel_st.image.height + win.ch-1)/win.ch; ++i) { int x; - tclearregion(term.c.x, term.c.y, term.c.x+(sixel_st.image.width+win.cw-1)/win.cw, term.c.y); + tclearregion(term.c.x, term.c.y, term.c.x+(sixel_st.image.width+win.cw-1)/win.cw-1, term.c.y); for (x = term.c.x; x < MIN(term.col, term.c.x+(sixel_st.image.width+win.cw-1)/win.cw); x++) term.line[term.c.y][x].mode |= ATTR_SIXEL; - tnewline(1); + tnewline(0); } } #endif // SIXEL_PATCH diff --git a/x.c b/x.c index c2f5a59..9b45076 100644 --- a/x.c +++ b/x.c @@ -2949,28 +2949,19 @@ void xfinishdraw(void) { #if SIXEL_PATCH - ImageList *im; + ImageList *im, *next; XGCValues gcvalues; GC gc; #endif // SIXEL_PATCH #if SIXEL_PATCH - for (im = term.images; im; im = im->next) { - if (term.images == NULL) { - /* last image was deleted, bail out */ - break; - } + for (im = term.images; im; im = next) { + /* get the next image here, because delete_image() will delete the current image */ + next = im->next; if (im->should_delete) { delete_image(im); - - /* prevent the next iteration from accessing an invalid image pointer */ - im = term.images; - if (im == NULL) { - break; - } else { - continue; - } + continue; } if (!im->pixmap) { @@ -3005,7 +2996,8 @@ xfinishdraw(void) } memset(&gcvalues, 0, sizeof(gcvalues)); - gc = XCreateGC(xw.dpy, xw.win, 0, &gcvalues); + gcvalues.graphics_exposures = False; + gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures, &gcvalues); #if ANYSIZE_PATCH XCopyArea(xw.dpy, (Drawable)im->pixmap, xw.buf, gc, 0, 0, im->width, im->height, win.hborderpx + im->x * win.cw, win.vborderpx + im->y * win.ch);