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

Make CascadiaSettings a WinRT object #7457

Merged
6 commits merged into from
Sep 9, 2020
Merged

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Aug 28, 2020

CascadiaSettings is now a WinRT object in the TerminalApp project.

References

#7141 - CascadiaSettings is a settings object
#885 - this new settings object will be moved to a new TerminalSettingsModel project

This one looks big, but most of it is really just propagating the
changes to the tests. In fact, you can probably save yourself some time
because the tests were about an hour of Find&Replace.

CascadiaSettings::GetCurrentAppSettings() was only being used in
Pane.cpp. So I ripped out the 3 lines of code and stuffed them in there.

Follow-up work:

Validation Steps Performed

  • Tests passed
  • Deployment succeeded

Closes #7141

@ghost ghost added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Aug 28, 2020
@carlos-zamora

This comment has been minimized.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

15/17

if (equals(profileGuid, guid))
{
std::iter_swap(_profiles.begin() + pIndex, _profiles.begin() + gIndex);
auto prof1 = _profiles.GetAt(pIndex);
Copy link
Member

Choose a reason for hiding this comment

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

i bet there's a way to use iterators here ;P

Copy link
Member Author

Choose a reason for hiding this comment

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

So, the problem is more the +pIndex and +gIndex. When I do this:

std::iter_swap(_profiles.First() + pIndex, _profiles.First() + gIndex);

there isn't a + operator found :(

Copy link
Member

Choose a reason for hiding this comment

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

Ugh, there's a bunch of iterator helpers that are private. Bah.

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Sep 4, 2020
@carlos-zamora

This comment has been minimized.

_profiles.end(),
[](auto&& profile) { return profile.Hidden(); }),
_profiles.end());
for (uint32_t i{}; i < _profiles.Size();)
Copy link
Member

Choose a reason for hiding this comment

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

Oh, please just assign 0 to i. I know the {} will technically default construct it to 0, but that's so much more obtuse than the thing everyone recognizes.

Copy link
Member

Choose a reason for hiding this comment

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

ha! you know, i thought you were part of our discussions about zero-initializing things with {}, and perhaps with the ayes and not the nays

Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

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

Looks like it does what it says on the box. I'd prefer to have Dustin also sign, though, as he has a bit more WinRT experience and sees things I don't.

@carlos-zamora carlos-zamora force-pushed the dev/cazamor/set/winrt-app-obj-top branch from 641e1c7 to 1885822 Compare September 9, 2020 18:04
@@ -616,9 +629,9 @@ namespace winrt::TerminalApp::implementation
try
{
auto newSettings = _isUwp ? CascadiaSettings::LoadUniversal() : CascadiaSettings::LoadAll();
_settings.copy_from(winrt::get_self<CascadiaSettings>(newSettings));
_settings = newSettings;
Copy link
Member

Choose a reason for hiding this comment

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

to save eight nanoseconds you could do uh

Suggested change
_settings = newSettings;
_settings = std::move(newSettings);

or just _settings = isUwp ? xxx : yyy

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Sep 9, 2020
@ghost
Copy link

ghost commented Sep 9, 2020

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit c5cf7b8 into master Sep 9, 2020
@ghost ghost deleted the dev/cazamor/set/winrt-app-obj-top branch September 9, 2020 20:49
@carlos-zamora carlos-zamora restored the dev/cazamor/set/winrt-app-obj-top branch September 9, 2020 20:50
@ghost
Copy link

ghost commented Sep 22, 2020

🎉Windows Terminal Preview v1.4.2652.0 has been released which incorporates this pull request.:tada:

Handy links:

@DHowett DHowett deleted the dev/cazamor/set/winrt-app-obj-top branch February 5, 2021 19:07
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transform TerminalApp settings objects into WinRT objects
3 participants