Commit: patch 9.2.0863: MS-Windows GUI: window contents can be missing when VimEnter is slow

Christian Brabandt <[email protected]> Mon, 27 Jul 2026 22:30:03 +0200
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
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 <[email protected]>
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 <[email protected]>
    Signed-off-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

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,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1woRxb-00HByJ-Cc%40256bit.org.