Re: [vim/vim] GUI: colors from the vimrc are shown only after a slow VimEnter (PR #20807)

h_east (Vim Github Repository) <[email protected]>
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/20807/[email protected]>
h-east left a comment (vim/vim#20807)

I replaced the patch with a much smaller MS-Windows only change. An
instrumented build showed that the cause is not the timing of the colors, so
drawing the screen before the VimEnter autocommands was treating a symptom.

What actually happens on MS-Windows: the text area is a child window and its
class is registered without a background brush, so only Vim's own drawing ever
puts pixels there. The window is shown before the screen contents exist. The
one WM_PAINT that arrives at that moment is discarded, because
`gui_redraw_block()` returns early while the screen has not been cleared yet,
and `BeginPaint()`/`EndPaint()` validate the region anyway. No further
WM_PAINT is ever generated, so the window keeps undefined pixels until Vim
draws the screen for the first time. A slow VimEnter autocommand delays that,
and those pixels are the white window in the report.

The new patch fills the text area with the background color when the screen
contents are not available, and paints it again when the background color
changes while only that color is shown.

@dezza this is now confined to the w32 code as you suggested. It turned out
you were right for a concrete reason: GTK draws into an offscreen surface and
presents it only when the event loop runs, so it never shows a half painted
window, and the previous patch changed nothing there.

@chrisbra the annoying switch you asked about cannot happen with this
approach, since nothing is drawn any earlier than it is today. Only the color
of the still empty window changes.

Verified on MS-Windows gVim. With the colorscheme in a vimrc there is no white
at all. With the colors set from a `+cmd`, as in the steps in the issue, the
window is white for about 95 ms instead of the whole VimEnter, because the
color is simply not known yet when the window is first painted.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20807#issuecomment-5081016491
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/20807/[email protected]>

-- 
-- 
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/vim/vim/pull/20807/c5081016491%40github.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.