From 647da34bbd4cf19a4bcc11899df24e00d6b8fcbe Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 18 Sep 2022 22:55:30 +0800 Subject: fix: assert failure when changing 'ut' while waiting for CursorHold (#20241) --- src/nvim/os/input.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 8fc4a5dce5..fc7390a303 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -133,7 +133,7 @@ int os_inchar(uint8_t *buf, int maxlen, int ms, int tb_change_cnt, MultiQueue *e } } else { uint64_t wait_start = os_hrtime(); - assert((int)p_ut >= cursorhold_time); + cursorhold_time = MIN(cursorhold_time, (int)p_ut); if ((result = inbuf_poll((int)p_ut - cursorhold_time, events)) == kInputNone) { if (read_stream.closed && silent_mode) { // Drained eventloop & initial input; exit silent/batch-mode (-es/-Es). @@ -148,7 +148,6 @@ int os_inchar(uint8_t *buf, int maxlen, int ms, int tb_change_cnt, MultiQueue *e } } else { cursorhold_time += (int)((os_hrtime() - wait_start) / 1000000); - cursorhold_time = MIN(cursorhold_time, (int)p_ut); } } -- cgit