Add enable-sixel option.

pull/3592/head
topcat001 2023-05-27 12:56:57 -07:00
parent e4aefd62ef
commit 71dc6d7138
3 changed files with 16 additions and 2 deletions

View File

@ -2244,6 +2244,7 @@ input_dcs_dispatch(struct input_ctx *ictx)
const u_int prefixlen = (sizeof prefix) - 1;
struct sixel_image *si;
long long allow_passthrough = 0;
long long enable_sixel = 0;
if (wp == NULL)
return (0);
@ -2260,7 +2261,8 @@ input_dcs_dispatch(struct input_ctx *ictx)
allow_passthrough == 2);
}
if (buf[0] == 'q') {
enable_sixel = options_get_number(wp->options, "enable-sixel");
if (enable_sixel && buf[0] == 'q') {
si = sixel_parse(buf, len, w->xpixel, w->ypixel);
if (si != NULL) {
sixel_log(si);

View File

@ -93,6 +93,9 @@ static const char *options_table_extended_keys_list[] = {
static const char *options_table_allow_passthrough_list[] = {
"off", "on", "all", NULL
};
static const char *options_table_enable_sixel_list[] = {
"off", "on", NULL
};
/* Status line format. */
#define OPTIONS_TABLE_STATUS_FORMAT1 \
@ -900,6 +903,15 @@ const struct options_table_entry options_table[] = {
.text = "Style of the marked line in copy mode."
},
{ .name = "enable-sixel",
.type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.choices = options_table_enable_sixel_list,
.default_num = 0,
.text = "Whether sixel sequences are allowed "
"Can be 'off' (disallowed), or 'on' (allowed)."
},
{ .name = "fill-character",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,

2
tty.c
View File

@ -2231,7 +2231,7 @@ tty_cmd_sixelimage(struct tty *tty, const struct tty_ctx *ctx)
int fallback = 0;
if ((~tty->term->flags & TERM_SIXEL) &&
!tty_term_has(tty->term, TTYC_SXL))
!tty_term_has(tty->term, TTYC_SXL))
fallback = 1;
if (tty->xpixel == 0 || tty->ypixel == 0)
fallback = 1;