aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2021-12-10 12:42:37 +0000
committernicm <nicm>2021-12-10 12:42:37 +0000
commitdb3aabcc34464940c286d7ce3abc8f3edc94b7bc (patch)
treea8ddf220a49c787f87c469205387a21c5e0eeee9
parentd721fb2a9fd70c157abb8540d4c50fca654f9f4d (diff)
downloadrtmux-db3aabcc34464940c286d7ce3abc8f3edc94b7bc.tar.gz
rtmux-db3aabcc34464940c286d7ce3abc8f3edc94b7bc.tar.bz2
rtmux-db3aabcc34464940c286d7ce3abc8f3edc94b7bc.zip
Add a NOBLOCK flag rather than adding amount to wait for when
dealing with potentially-long sequences. GitHub issue 3001.
-rw-r--r--tmux.h2
-rw-r--r--tty.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/tmux.h b/tmux.h
index dfea1583..e6a33104 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1311,7 +1311,7 @@ struct tty {
#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 */
diff --git a/tty.c b/tty.c
index a9678eaf..3aefe784 100644
--- a/tty.c
+++ b/tty.c
@@ -206,6 +206,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);
@@ -2088,8 +2093,8 @@ tty_set_selection(struct tty *tty, const char *buf, size_t len)
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);
}
@@ -2097,6 +2102,7 @@ tty_set_selection(struct tty *tty, const char *buf, size_t len)
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);
}