From ad2fad9a3b07d84e24c189b6a5773e979e8c0afd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 20 Oct 2023 23:02:56 +0800 Subject: [PATCH] fix(event-loop): flush UI when no input is available (#25728) Problem: With lots of events, UI flush may be delayed for too long. Solution: Flush UI when no input is available. This still flushes less frequently than before #25629, when a flush also happens when typeahead buffer is empty but input is available. --- src/nvim/state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nvim/state.c b/src/nvim/state.c index 424fda2ede..61e8d8d2ff 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -59,6 +59,8 @@ getkey: if (vpeekc() != NUL || typebuf.tb_len > 0) { key = safe_vgetc(); } else if (!multiqueue_empty(main_loop.events)) { + // No input available and processing events may take time, flush now. + ui_flush(); // Event was made available after the last multiqueue_process_events call key = K_EVENT; } else {