-/* $OpenBSD: tmux.h,v 1.1155 2021/11/15 10:58:13 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1156 2021/12/10 12:42:37 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#define TTY_NOCURSOR 0x1
#define TTY_FREEZE 0x2
#define TTY_TIMER 0x4
-/* 0x8 unused */
+#define TTY_NOBLOCK 0x8
#define TTY_STARTED 0x10
#define TTY_OPENED 0x20
/* 0x40 unused */
-/* $OpenBSD: tty.c,v 1.413 2021/12/06 10:08:42 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.414 2021/12/10 12:42:37 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
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);
encoded = xmalloc(size);
b64_ntop(buf, len, encoded, size);
+ tty->flags |= TTY_NOBLOCK;
tty_putcode_ptr2(tty, TTYC_MS, "", encoded);
- tty->client->redraw = EVBUFFER_LENGTH(tty->out);
free(encoded);
}
void
tty_cmd_rawstring(struct tty *tty, const struct tty_ctx *ctx)
{
+ tty->flags |= TTY_NOBLOCK;
tty_add(tty, ctx->ptr, ctx->num);
tty_invalidate(tty);
}