From a5b1e209417b7d3f5b0099642dd317c312f79377 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 28 Nov 2019 14:20:22 +0000 Subject: [PATCH] Add a flag to disable blocking while sending a SIXEL image (turned off when the buffer hits 0 size). --- tmux.h | 1 + tty.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/tmux.h b/tmux.h index 7c901b9d..b1e7f44e 100644 --- a/tmux.h +++ b/tmux.h @@ -1203,6 +1203,7 @@ struct tty { #define TTY_OPENED 0x20 #define TTY_FOCUS 0x40 #define TTY_BLOCK 0x80 +#define TTY_NOBLOCK 0x100 int flags; struct tty_term *term; diff --git a/tty.c b/tty.c index cae2fd24..da21645f 100644 --- a/tty.c +++ b/tty.c @@ -211,6 +211,11 @@ tty_block_maybe(struct tty *tty) size_t size = EVBUFFER_LENGTH(tty->out); struct timeval tv = { .tv_usec = TTY_BLOCK_INTERVAL }; + if (size == 0) + tty->flags &= ~TTY_NOBLOCK; + else if (tty->flags & TTY_NOBLOCK) + return (0); + if (size < TTY_BLOCK_START(tty)) return (0); @@ -1872,6 +1877,7 @@ tty_cmd_rawsixel(struct tty *tty, const struct tty_ctx *ctx) int flags = (tty->term->flags|tty->term_flags); if ((flags & TERM_SIXEL) || tty_term_has(tty->term, TTYC_SXL)) { + tty->flags |= TTY_NOBLOCK; tty_add(tty, ctx->ptr, ctx->num); if (!ctx->more) tty_invalidate(tty);