Pass through SIXEL DCS sequences (treat similarly to the passthrough escape

sequence) if it appears the terminal outside supports them.
This commit is contained in:
Nicholas Marriott
2019-11-28 12:35:18 +00:00
parent e00730d149
commit b34111b3da
7 changed files with 57 additions and 10 deletions

18
input.c
View File

@@ -1305,8 +1305,8 @@ input_csi_dispatch(struct input_ctx *ictx)
if (ictx->flags & INPUT_DISCARD)
return (0);
log_debug("%s: '%c' \"%s\" \"%s\"",
__func__, ictx->ch, ictx->interm_buf, ictx->param_buf);
log_debug("%s: '%c' \"%s\" \"%s\"", __func__, ictx->ch,
ictx->interm_buf, ictx->param_buf);
if (input_split(ictx) != 0)
return (0);
@@ -2151,19 +2151,27 @@ static int
input_dcs_dispatch(struct input_ctx *ictx)
{
struct screen_write_ctx *sctx = &ictx->ctx;
u_char *buf = ictx->input_buf;
size_t len = ictx->input_len;
u_char *buf = ictx->input_buf, *pbuf = ictx->param_buf;
size_t len = ictx->input_len, plen = ictx->param_len;
const char prefix[] = "tmux;";
const u_int prefixlen = (sizeof prefix) - 1;
if (ictx->flags & INPUT_DISCARD)
return (0);
log_debug("%s: \"%s\"", __func__, buf);
log_debug("%s: \"%s\" \"%s\" \"%s\"", __func__, buf, ictx->interm_buf,
ictx->param_buf);
if (len >= prefixlen && strncmp(buf, prefix, prefixlen) == 0)
screen_write_rawstring(sctx, buf + prefixlen, len - prefixlen);
if (buf[0] == 'q') {
screen_write_rawsixel(sctx, (char *)"\033P", 2, 1);
screen_write_rawsixel(sctx, pbuf, plen, 1);
screen_write_rawsixel(sctx, buf, len, 1);
screen_write_rawsixel(sctx, (char *)"\033\\", 2, 0);
}
return (0);
}