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.
This commit is contained in:
zeertzjq 2023-10-20 23:02:56 +08:00 committed by GitHub
parent 6c87d3e0fb
commit ad2fad9a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {