From 6ee215a7797cbb15aed6136ccfcaf5daff5ae654 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 12 Feb 2017 19:46:13 -0500 Subject: 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 --- src/pty-unix.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/pty-unix.c') 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; +} -- cgit v1.2.3-54-g00ecf