Kitty image input path.

This commit is contained in:
Nicholas Marriott
2026-10-16 17:26:41 +01:00
parent bfb01dcb54
commit 4237434271
29 changed files with 3389 additions and 73 deletions

16
input.c
View File

@@ -144,6 +144,9 @@ struct input_ctx {
*/
struct evbuffer *since_ground;
struct event ground_timer;
#ifdef ENABLE_IMAGES
void *kitty_state;
#endif
};
/* Helper functions. */
@@ -913,6 +916,9 @@ input_free(struct input_ctx *ictx)
event_del(&ictx->request_timer);
free(ictx->input_buf);
#ifdef ENABLE_IMAGES
kitty_free_state(ictx->kitty_state);
#endif
evbuffer_free(ictx->since_ground);
event_del(&ictx->ground_timer);
@@ -1172,7 +1178,7 @@ input_send_reply(struct input_ctx *ictx, const char *reply)
}
/* Reply to terminal query. */
static void printflike(3, 4)
void printflike(3, 4)
input_reply(struct input_ctx *ictx, int add, const char *fmt, ...)
{
struct input_request *ir;
@@ -2803,6 +2809,14 @@ input_exit_apc(struct input_ctx *ictx)
return;
log_debug("%s: \"%s\" (size %zu)", __func__, buf, len);
#ifdef ENABLE_IMAGES
if (wp != NULL && len > 1 && buf[0] == 'G') {
kitty_parse_input(ictx, wp, sctx, ictx->cell.cell.bg,
&ictx->kitty_state, buf, len);
return;
}
#endif
if (wp != NULL &&
options_get_number(wp->options, "allow-set-title") &&
screen_set_title(sctx->s, buf, 1)) {