patch 9.2.0863: MS-Windows GUI: window contents can be missing when VimEnter is slow
Commit:
https://github.com/vim/vim/commit/f546abd51b72b46429bec32dfd093ef6868035c4
Author: Hirohito Higashi <
h.eas...@gmail.com>
Date: Mon Jul 27 20:19:48 2026 +0000
patch 9.2.0863: MS-Windows GUI: window contents can be missing when VimEnter is slow
Problem: On MS-Windows the text area can stay undrawn while a slow VimEnter
autocommand runs, so the window shows what was on the screen behind
it. Whether this happens depends on when the first paint message
arrives.
Solution: Draw the text area when the window is opened, instead of waiting for
the message loop.
related: #20807
closes: #20858
Co-Authored-By: Claude Opus 5 <
nor...@anthropic.com>
Signed-off-by: Hirohito Higashi <
h.eas...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 7e6c87ee2..0960b0d82 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -1665,8 +1665,18 @@ gui_mch_open(void)
// Actually open the window, if not already visible
// (may be done already in gui_mch_set_shellsize)
if (!IsWindowVisible(s_hwnd))
+ {
ShowWindow(s_hwnd, SW_SHOWDEFAULT);
+ // Waiting for the message loop leaves the window undrawn while a
+ // slow VimEnter autocommand runs. The flush presents the DirectX draw.
+ if (s_textArea != NULL)
+ {
+ UpdateWindow(s_textArea);
+ gui_mch_flush();
+ }
+ }
+
#ifdef MSWIN_FIND_REPLACE
// Init replace string here, so that we keep it when re-opening the
// dialog.
diff --git a/src/version.c b/src/version.c
index 42d645ef4..e5dfd3eaa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 863,
/**/
862,
/**/