From 78df9eb51d7e0b61de94b8dd32d0c3782e18ba39 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 8 Jun 2019 13:02:26 +0200 Subject: vim-patch:1ebff3dc9 #10144 patch 8.1.0158: GUI: input() fails if CTRL-C was pressed before Problem: GUI: input() fails if CTRL-C was pressed before. (Michael Naumann) Solution: call vpeekc() to drop the CTRL-C from the input stream. https://github.com/vim/vim/commit/1ebff3dc93b6d022ccfe0613c1d1ee2d62fc7935 --- src/nvim/ex_docmd.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index f4082fc833..fb15bd4e66 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7415,6 +7415,12 @@ void do_sleep(long msec) LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, (int)next, got_int); os_breakcheck(); } + + // If CTRL-C was typed to interrupt the sleep, drop the CTRL-C from the + // input buffer, otherwise a following call to input() fails. + if (got_int) { + (void)vpeekc(); + } } static void do_exmap(exarg_T *eap, int isabbrev) -- cgit