patch 7.4.1873
Problem: When a callback adds a timer the GUI doesn't use it until later.
(Ramel Eshed)
Solution: Return early if a callback adds a timer.
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 10c14c9..82ca7de 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2022,6 +2022,22 @@
process_message();
}
+ static void
+remove_any_timer(void)
+{
+ MSG msg;
+
+ if (s_wait_timer != 0 && !s_timed_out)
+ {
+ KillTimer(NULL, s_wait_timer);
+
+ /* Eat spurious WM_TIMER messages */
+ while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
+ ;
+ s_wait_timer = 0;
+ }
+}
+
/*
* GUI input routine called by gui_wait_for_chars(). Waits for a character
* from the keyboard.
@@ -2073,6 +2089,9 @@
s_need_activate = FALSE;
}
+#ifdef FEAT_TIMERS
+ did_add_timer = FALSE;
+#endif
#ifdef MESSAGE_QUEUE
/* Check channel while waiting message. */
for (;;)
@@ -2098,15 +2117,7 @@
if (input_available())
{
- if (s_wait_timer != 0 && !s_timed_out)
- {
- KillTimer(NULL, s_wait_timer);
-
- /* Eat spurious WM_TIMER messages */
- while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
- ;
- s_wait_timer = 0;
- }
+ remove_any_timer();
allow_scrollbar = FALSE;
/* Clear pending mouse button, the release event may have been
@@ -2117,6 +2128,15 @@
return OK;
}
+
+#ifdef FEAT_TIMERS
+ if (did_add_timer)
+ {
+ /* Need to recompute the waiting time. */
+ remove_any_timer();
+ break;
+ }
+#endif
}
allow_scrollbar = FALSE;
return FAIL;