diff options
author | Jesse Luehrs <doy@tozt.net> | 2017-02-12 19:46:13 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2017-02-12 19:46:13 -0500 |
commit | 6ee215a7797cbb15aed6136ccfcaf5daff5ae654 (patch) | |
tree | 718b88f2b96ba35478e28ea2039f0054789b04af /src/pty-unix.c | |
parent | eab84456897848eb9c6a0d24eb8f5e2fbc4f8969 (diff) | |
download | runes-6ee215a7797cbb15aed6136ccfcaf5daff5ae654.tar.gz runes-6ee215a7797cbb15aed6136ccfcaf5daff5ae654.zip |
combine flushes when reading large amounts of data
on linux at least, you can only read 4096 bytes of data from a pty, so
large writes would cause a lot of redraws
Diffstat (limited to 'src/pty-unix.c')
-rw-r--r-- | src/pty-unix.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pty-unix.c b/src/pty-unix.c index 6cc4996..d712aad 100644 --- a/src/pty-unix.c +++ b/src/pty-unix.c @@ -20,6 +20,7 @@ extern char **environ; static int runes_pty_input_cb(void *t); +static void runes_pty_flush_cb(void *t); RunesPty *runes_pty_new() { @@ -164,7 +165,10 @@ static int runes_pty_input_cb(void *t) ((RunesTerm *)t)->scr, pty->readbuf, to_process); pty->remaininglen = to_process - processed; memmove(pty->readbuf, pty->readbuf + processed, pty->remaininglen); - runes_window_flush(t); + if (!pty->scheduled_flush) { + runes_loop_at_idle(((RunesTerm *)t)->loop, t, runes_pty_flush_cb); + pty->scheduled_flush = 1; + } return 1; } @@ -175,3 +179,11 @@ static int runes_pty_input_cb(void *t) return 0; } } + +static void runes_pty_flush_cb(void *t) +{ + RunesPty *pty = ((RunesTerm *)t)->pty; + + runes_window_flush(t); + pty->scheduled_flush = 0; +} |