-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(tui): initialize clear attrs with current terminal background #28676
Conversation
Was unsuccessful in adding a test for this so far, can try again tomorrow if this fix seems right to you @bfredl. |
I am not sure this fixes #28667. Using the init script mentioned in that file: colorscheme blue
au VimEnter * sleep 1 with It might fix #28668, but I'm not at my laptop at the moment to verify. I can check tomorrow. |
Oh? I don't see the black screen. Are you actually seeing a black screen or is your terminal background black and is that what you're seeing? That's what I see and what I would expect after this change. I.e. no flickering but colorscheme being applied after the delay since that's the first moment the screen is drawn. EDIT: Hmm seems terminal dependent, I do still get a black screen in wezterm, not in st or kitty. Not sure about the fix then. Moving It does also fix #28668 (on my end) but didn't link it here because we may want to keep that open until it has been decided when to call |
Weird, I still see the black screen on every terminal I've tried (Ghostty, Alacritty, WezTerm, and Kitty).
My terminal background color is #2e3440, which is not black. The "black" is, I believe, the default colorscheme background, which is #14161b. |
Probably timing related instead then(for me the results are consistent depending on the terminal on a relatively old laptop)...
No I don't think it is the default colorscheme background in these cases(the ones from #28667 and #28668). What we're seeing is actually black(#000000) because the diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index c4fb57c95a..43725a8214 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -2912,12 +2912,12 @@ color_name_table_T color_name_table[] = {
{ "NvimDarkBlue", RGB_(0x00, 0x4c, 0x73) },
{ "NvimDarkCyan", RGB_(0x00, 0x73, 0x73) },
{ "NvimDarkGray1", RGB_(0x07, 0x08, 0x0d) },
- { "NvimDarkGray2", RGB_(0x14, 0x16, 0x1b) },
+ { "NvimDarkGrey2", RGB_(0xff, 0xff, 0xff) },
{ "NvimDarkGray3", RGB_(0x2c, 0x2e, 0x33) },
{ "NvimDarkGray4", RGB_(0x4f, 0x52, 0x58) },
{ "NvimDarkGreen", RGB_(0x00, 0x55, 0x23) },
{ "NvimDarkGrey1", RGB_(0x07, 0x08, 0x0d) },
- { "NvimDarkGrey2", RGB_(0x14, 0x16, 0x1b) },
+ { "NvimDarkGrey2", RGB_(0xff, 0xff, 0xff) },
{ "NvimDarkGrey3", RGB_(0x2c, 0x2e, 0x33) },
{ "NvimDarkGrey4", RGB_(0x4f, 0x52, 0x58) },
{ "NvimDarkMagenta", RGB_(0x47, 0x00, 0x45) }, |
Updated again with a simpler solution that achieves the same result in more cases(I noticed the previous solution didn't work when resizing during startup). Also added a comment which better explains the current situation and it's limitations(as I understand it). |
Problem: Invalidated regions that are flushed during startup are cleared with unitialized "clear_attrs", which is perceived as flickering. Solution: Initialize "clear_attrs" with current terminal background color.
@@ -2003,6 +2003,39 @@ describe('TUI', function() | |||
]]) | |||
end) | |||
|
|||
it('invalidated regions are cleared with terminal background attr', function() | |||
local screen = Screen.new(50, 10) | |||
screen:set_default_attr_ids({ [1] = { foreground = Screen.colors.Black } }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test that at least fails on master, although I'm not sure if it tests for the behavior correctly. Presumably Screen.colors.Black
is normal_bg
, in which case it does. Could also mean that the test still produces an unwanted black screen here? I can no longer reproduce that locally.
Problem: Fix added in neovim#28676 worked accidentally for RGB color, and did not work for cterm. Solution: Intentionally initialize clear_attrs to -1 and update comment.
Problem: Fix added in neovim#28676 worked accidentally for RGB color, and did not work for cterm. Solution: Intentionally initialize clear_attrs to -1 and update comment.
Problem: Fix added in neovim#28676 worked accidentally(used variables were themselves uninitialized at this point during startup) and does not always work. Solution: Reset attributes when clearing regions during startup.
Problem: Fix added in neovim#28676 worked accidentally(used variables were themselves uninitialized at this point during startup) and does not always work. Solution: Reset attributes when clearing regions during startup.
Problem: Fix added in neovim#28676 worked accidentally(used variables were themselves uninitialized at this point during startup) and does not always work. Solution: Reset attributes when clearing regions during startup.
Problem: Fix added in neovim#28676 worked accidentally(used variables were themselves uninitialized at this point during startup) and does not always work. Solution: Reset attributes when clearing regions during startup.
Problem: Fix added in #28676 worked accidentally(used variables were themselves uninitialized at this point during startup) and does not always work. Solution: Reset attributes when clearing regions during startup.
Problem: Fix added in neovim#28676 worked accidentally(used variables were themselves uninitialized at this point during startup) and does not always work. Solution: Reset attributes when clearing regions during startup.
Problem: Invalidated regions that are flushed during startup are
cleared with unitialized "clear_attrs", which is perceived as
flickering.
Solution: Initialize "clear_attrs" with current terminal background color.
Fix #28667