diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-04-25 12:32:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 12:32:06 +0200 |
commit | 965ad7726f91c2597ef6eb7a740ae024da99ec9b (patch) | |
tree | 431f38d607eb9b3f9b589cae64cf90e718fca42e /src/nvim/os/input.c | |
parent | a4b2400804355e99813f39a6b38d8f38667f8bdd (diff) | |
parent | 0d2fe7786537ef63d0d3ed1e94546eb3ee35a368 (diff) | |
download | rneovim-965ad7726f91c2597ef6eb7a740ae024da99ec9b.tar.gz rneovim-965ad7726f91c2597ef6eb7a740ae024da99ec9b.tar.bz2 rneovim-965ad7726f91c2597ef6eb7a740ae024da99ec9b.zip |
Merge pull request #23293 from bfredl/bigsleep
refactor(time): refactor delay with input checking
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r-- | src/nvim/os/input.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index d472836d0a..e9f23eba40 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -441,7 +441,7 @@ bool input_blocking(void) // This is a replacement for the old `WaitForChar` function in os_unix.c static InbufPollResult inbuf_poll(int ms, MultiQueue *events) { - if (input_ready(events)) { + if (os_input_ready(events)) { return kInputAvail; } @@ -457,14 +457,14 @@ static InbufPollResult inbuf_poll(int ms, MultiQueue *events) DLOG("blocking... events_enabled=%d events_pending=%d", events != NULL, events && !multiqueue_empty(events)); LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, ms, - input_ready(events) || input_eof); + os_input_ready(events) || input_eof); blocking = false; if (do_profiling == PROF_YES && ms) { prof_inchar_exit(); } - if (input_ready(events)) { + if (os_input_ready(events)) { return kInputAvail; } return input_eof ? kInputEof : kInputNone; @@ -530,8 +530,8 @@ static int push_event_key(uint8_t *buf, int maxlen) return buf_idx; } -// Check if there's pending input -static bool input_ready(MultiQueue *events) +/// Check if there's pending input already in typebuf or `events` +bool os_input_ready(MultiQueue *events) { return (typebuf_was_filled // API call filled typeahead || rbuffer_size(input_buffer) // Input buffer filled |