Merge pull request #17279 from zeertzjq/state-enter-vpeekc

fix(event-loop): call vpeekc() directly first to check for character
This commit is contained in:
bfredl
2022-02-06 19:22:02 +01:00
committed by GitHub
4 changed files with 43 additions and 8 deletions

View File

@@ -3189,7 +3189,7 @@ static void getchar_common(typval_T *argvars, typval_T *rettv)
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())) {
if (!char_avail()) {
(void)os_inchar(NULL, 0, -1, 0, main_loop.events);
if (!multiqueue_empty(main_loop.events)) {
state_handle_k_event();