Add a flag to disable blocking while sending a SIXEL image (turned off when the

buffer hits 0 size).
This commit is contained in:
Nicholas Marriott 2019-11-28 14:20:22 +00:00
parent 968382aa6a
commit a5b1e20941
2 changed files with 7 additions and 0 deletions

1
tmux.h
View File

@ -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;

6
tty.c
View File

@ -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);