]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0863: MS-Windows GUI: window contents can be missing when VimEnter is slow v9.2.0863
authorHirohito Higashi <h.east.727@gmail.com>
Mon, 27 Jul 2026 20:19:48 +0000 (20:19 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 27 Jul 2026 20:19:48 +0000 (20:19 +0000)
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 <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui_w32.c
src/version.c

index 7e6c87ee231765b67f783dba70ca71c2ad8e5c95..0960b0d82ff63b9a9044458dbcfa9311830c3f4a 100644 (file)
@@ -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.
index 42d645ef498d7a35fd3d3eac917b87fd6d1a11aa..e5dfd3eaa3715629990f4baec3b268683e247445 100644 (file)
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    863,
 /**/
     862,
 /**/