Skip to content
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

Initialize the foreground and background in TermControl's constructor #9792

Closed
wants to merge 6 commits into from

Conversation

PankajBhojwani
Copy link
Contributor

@PankajBhojwani PankajBhojwani commented Apr 12, 2021

We recently moved setting the foreground and background out of
TermControl::_ApplyUISettings , but that means we no longer set the
foreground/background in the constructor, resulting in the terminal
being gray on startup until we call UpdateAppearance after the
renderer is setup. This change sets the foreground and background in the
TermControl constructor to avoid this.

Validation Steps Performed

Terminal no longer starts up gray

// (they will also be called later in UpdateAppearance, but we want to have it here so
// that the terminal is not gray on startup)
const auto bg = _settings.DefaultBackground();
_BackgroundColorChanged(bg);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually.. afraid of this. BackgroundColorChanged is also a fire_and_forget which we should not use from the constructor (!)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for pointing that out. Fixed it here and in _UpdateAppearanceFromUIThreadUnderLock

@DHowett DHowett added the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Apr 13, 2021
@@ -198,8 +198,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// Set the foreground and background here in the constructor
// (they will also be called later in UpdateAppearance, but we want to have it here so
// that the terminal is not gray on startup)
const auto bg = _settings.DefaultBackground();
_BackgroundColorChanged(bg);
til::color newBgColor{ _settings.DefaultBackground() };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suspect you know what i am going to say about us having three copies of this code ;P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh haha alright that's fair... I was just trying to have it so there's only 1 update appearance call but okay will make a helper for the fg/bg

@DHowett
Copy link
Member

DHowett commented Apr 13, 2021

We're going to ship w/the gray flash. I'll keep this marked for Servicing.

@zadjii-msft zadjii-msft self-assigned this Apr 15, 2021
@zadjii-msft zadjii-msft assigned DHowett and unassigned zadjii-msft May 17, 2021
@zadjii-msft zadjii-msft added the Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) label May 17, 2021
@DHowett
Copy link
Member

DHowett commented May 17, 2021

Wow, this is still relevant @zadjii-msft with your split?

@PankajBhojwani
Copy link
Contributor Author

I cannot repro the 'starting up gray' issue so I'm closing this!

@DHowett DHowett removed the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Jul 7, 2021
@DHowett DHowett deleted the dev/pabhoj/control_bg_fg branch October 26, 2021 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants