mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
state: throttle batched event processing when input is available
before, calling vim.schedule() from inside an event would execute the scheduled callback immediately after this event without checking for user input in between. Break event processing whenever user input or an interrupt is available.
This commit is contained in:
@@ -3029,10 +3029,11 @@ static void f_getchar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
if (argvars[0].v_type == VAR_UNKNOWN) {
|
||||
// getchar(): blocking wait.
|
||||
// TODO(bfredl): deduplicate shared logic with state_enter ?
|
||||
if (!(char_avail() || using_script() || input_available())) {
|
||||
(void)os_inchar(NULL, 0, -1, 0, main_loop.events);
|
||||
if (!multiqueue_empty(main_loop.events)) {
|
||||
multiqueue_process_events(main_loop.events);
|
||||
state_handle_k_event();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user