Three SIXEL improvements from nincsnevem662 at gmail dot com in GitHub issue

4149:

- Pass P2 on the received image through when forwarding the image to the
  outside terminal to preserve transparency;

- Preserve raster attribute dimensions which may be smaller than the actual
  image (used to crop out parts of the image to work around the limitation that
  rows must come in groups of six);

- To avoid collapsing empty sixel lines, no longer ignore duplicate "-" new
  line specifiers.
This commit is contained in:
Nicholas Marriott
2024-10-04 07:49:07 +01:00
parent 2df15ad08c
commit 7a78cdf78c
3 changed files with 39 additions and 8 deletions

View File

@ -2320,6 +2320,7 @@ input_dcs_dispatch(struct input_ctx *ictx)
#ifdef ENABLE_SIXEL
struct window *w;
struct sixel_image *si;
int p2;
#endif
if (wp == NULL)
@ -2333,7 +2334,12 @@ input_dcs_dispatch(struct input_ctx *ictx)
#ifdef ENABLE_SIXEL
w = wp->window;
if (buf[0] == 'q') {
si = sixel_parse(buf, len, w->xpixel, w->ypixel);
if (input_split(ictx) != 0)
return (0);
p2 = input_get(ictx, 1, 0, 0);
if (p2 == -1)
p2 = 0;
si = sixel_parse(buf, len, p2, w->xpixel, w->ypixel);
if (si != NULL)
screen_write_sixelimage(sctx, si, ictx->cell.cell.bg);
}