-
Notifications
You must be signed in to change notification settings - Fork 8.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
Make CascadiaSettings a WinRT object #7457
Conversation
This comment has been minimized.
This comment has been minimized.
7d78e47
to
700290e
Compare
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.
15/17
if (equals(profileGuid, guid)) | ||
{ | ||
std::iter_swap(_profiles.begin() + pIndex, _profiles.begin() + gIndex); | ||
auto prof1 = _profiles.GetAt(pIndex); |
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.
i bet there's a way to use iterators here ;P
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.
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 :(
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.
Ugh, there's a bunch of iterator helpers that are private. Bah.
This comment has been minimized.
This comment has been minimized.
_profiles.end(), | ||
[](auto&& profile) { return profile.Hidden(); }), | ||
_profiles.end()); | ||
for (uint32_t i{}; i < _profiles.Size();) |
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.
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.
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.
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
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.
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.
641e1c7
to
1885822
Compare
@@ -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; |
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.
to save eight nanoseconds you could do uh
_settings = newSettings; | |
_settings = std::move(newSettings); |
or just _settings = isUwp ? xxx : yyy
Hello @DHowett! Because this pull request has the 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 (
|
🎉 Handy links: |
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 inPane.cpp. So I ripped out the 3 lines of code and stuffed them in there.
Follow-up work:
get_self
to be able to getthe warnings out. This will go away in the next PR (wrapping up Replace TerminalSettings runtimeclasses with interfaces only #885)
Validation Steps Performed
Closes #7141