patch 8.0.0854: no redraw after terminal was closed
Problem: No redraw after terminal was closed.
Solution: Set typebuf_was_filled. (Yasuhiro Matsumoto, closes #1925, closes
#1924) Add function to check for messages even when input is
available.
diff --git a/src/os_win32.c b/src/os_win32.c
index d3cab02..f75040c 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1400,10 +1400,11 @@
/*
* Wait until console input from keyboard or mouse is available,
* or the time is up.
+ * When "ignore_input" is TRUE even wait when input is available.
* Return TRUE if something is available FALSE if not.
*/
static int
-WaitForChar(long msec)
+WaitForChar(long msec, int ignore_input)
{
DWORD dwNow = 0, dwEndTime = 0;
INPUT_RECORD ir;
@@ -1440,7 +1441,7 @@
|| g_nMouseClick != -1
#endif
#ifdef FEAT_CLIENTSERVER
- || input_available()
+ || (!ignore_input && input_available())
#endif
)
return TRUE;
@@ -1583,8 +1584,19 @@
int
mch_char_avail(void)
{
- return WaitForChar(0L);
+ return WaitForChar(0L, FALSE);
}
+
+# if defined(FEAT_TERMINAL) || defined(PROTO)
+/*
+ * Check for any pending input or messages.
+ */
+ int
+mch_check_messages(void)
+{
+ return WaitForChar(0L, TRUE);
+}
+# endif
#endif
/*
@@ -1614,7 +1626,7 @@
DWORD cRecords = 0;
#ifdef FEAT_CLIENTSERVER
- (void)WaitForChar(-1L);
+ (void)WaitForChar(-1L, FALSE);
if (input_available())
return 0;
# ifdef FEAT_MOUSE
@@ -1681,7 +1693,7 @@
if (time >= 0)
{
- if (!WaitForChar(time)) /* no character available */
+ if (!WaitForChar(time, FALSE)) /* no character available */
return 0;
}
else /* time == -1, wait forever */
@@ -1693,7 +1705,7 @@
* write the autoscript file to disk. Or cause the CursorHold event
* to be triggered.
*/
- if (!WaitForChar(p_ut))
+ if (!WaitForChar(p_ut, FALSE))
{
#ifdef FEAT_AUTOCMD
if (trigger_cursorhold() && maxlen >= 3)
@@ -1723,7 +1735,7 @@
/* Keep looping until there is something in the typeahead buffer and more
* to get and still room in the buffer (up to two bytes for a char and
* three bytes for a modifier). */
- while ((typeaheadlen == 0 || WaitForChar(0L))
+ while ((typeaheadlen == 0 || WaitForChar(0L, FALSE))
&& typeaheadlen + 5 <= TYPEAHEADLEN)
{
if (typebuf_changed(tb_change_cnt))
@@ -5721,7 +5733,7 @@
/*
- * write `cbToWrite' bytes in `pchBuf' to the screen
+ * Write "cbToWrite" bytes in `pchBuf' to the screen.
* Returns the number of bytes actually written (at least one).
*/
static DWORD
@@ -5828,7 +5840,7 @@
if (p_wd)
{
- WaitForChar(p_wd);
+ WaitForChar(p_wd, FALSE);
if (prefix != 0)
prefix = 1;
}
@@ -6120,7 +6132,7 @@
# endif
Sleep((int)msec);
else
- WaitForChar(msec);
+ WaitForChar(msec, FALSE);
#endif
}