fix(getchar): flush screen before doing a blocking wait

This commit is contained in:
zeertzjq
2022-06-26 15:20:44 +08:00
parent 95b8e2c55f
commit b47f313151
2 changed files with 15 additions and 0 deletions

View File

@@ -2722,6 +2722,8 @@ static void getchar_common(typval_T *argvars, typval_T *rettv)
// getchar(): blocking wait.
// TODO(bfredl): deduplicate shared logic with state_enter ?
if (!char_avail()) {
// flush output before waiting
ui_flush();
(void)os_inchar(NULL, 0, -1, 0, main_loop.events);
if (!multiqueue_empty(main_loop.events)) {
state_handle_k_event();