Commit: patch 9.2.0858: MS-Windows GUI: white flash when VimEnter is slow
Christian Brabandt <[email protected]>
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <[email protected]> |
patch 9.2.0858: MS-Windows GUI: white flash when VimEnter is slow Commit: https://github.com/vim/vim/commit/70da6c1a995601042a88f059523a3c95f31d39ac Author: Hirohito Higashi <[email protected]> Date: Sun Jul 26 14:56:09 2026 +0000 patch 9.2.0858: MS-Windows GUI: white flash when VimEnter is slow Problem: In the MS-Windows GUI the window is shown before the screen is drawn for the first time. Until then it displays undefined content, which appears as a white flash when a VimEnter autocommand delays the first redraw. Solution: Use the background color for the window as long as the screen contents are not available, and paint it again when the background color changes while only that color is shown. fixes: #20757 closes: #20807 Co-Authored-By: Claude Opus 5 (1M context) <[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 d9dbe65ac..7e6c87ee2 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -379,6 +379,11 @@ static WPARAM s_wParam = 0; static LPARAM s_lParam = 0; static HWND s_textArea = NULL; + +// Set when the text area was painted with the background color only, because +// the screen contents were not available yet. +static bool s_textarea_bg_only = false; + static UINT s_uMsg = 0; static char_u *s_textfield; // Used by dialogs to pass back strings @@ -1632,6 +1637,10 @@ gui_mch_new_colors(void) prevBrush = (HBRUSH)SetClassLongPtr( s_hwnd, GCLP_HBRBACKGROUND, (LONG_PTR)s_brush); InvalidateRect(s_hwnd, NULL, TRUE); + // The text area is a child window, the invalidation above does not + // include it. + if (s_textarea_bg_only && s_textArea != NULL) + InvalidateRect(s_textArea, NULL, TRUE); DeleteObject(prevBrush); } @@ -3714,6 +3723,15 @@ _OnPaint( if (!IsRectEmpty(&ps.rcPaint)) { + // The text area has no background brush, thus undefined pixels remain + // visible until the screen contents are drawn. + if (!screen_cleared || ScreenLines == NULL) + { + clear_rect(&ps.rcPaint); + s_textarea_bg_only = true; + } + else + s_textarea_bg_only = false; gui_redraw(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left + 1, ps.rcPaint.bottom - ps.rcPaint.top + 1); diff --git a/src/version.c b/src/version.c index ba72d4ad8..8dcb28fb0 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 */ +/**/ + 858, /**/ 857, /**/ -- -- 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/E1wo0Kj-00F4kE-A9%40256bit.org.