Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sixel issues and add a clearing sequence #99

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions st.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
22 changes: 7 additions & 15 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down