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

Introduce KeyMapping and Move TerminalSettings construction #7537

Merged
11 commits merged into from
Sep 14, 2020

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Sep 4, 2020

KeyMapping was introduced to break up AppKeyBindings. KeyMapping
records the keybindings from the JSON and lets you query them.
AppKeyBindings now just holds a ShortcutActionDispatcher to run
actions, and a KeyMapping to record/query your existing keybindings.
This refactor allows KeyMapping to be moved to the
TerminalSettingsModel, and ShortcutActionDispatcher and
AppKeyBindings will stay in TerminalApp.

AppKeyBindings had to be passed down to a terminal via
TerminalSettings. Since each settings object had its own
responsibility to update/create a TerminalSettings object, I moved all
of that logic to TerminalSettings. This helps with the
TerminalSettingsModel refactor, and makes the construction of
TerminalSettings a bit cleaner and more centralized.

References

#885 - this is all in preparation for the TerminalSettingsModel

Validation Steps Performed

  • Tests passed
  • Deployment succeeded

Copy link
Contributor

@leonMSFT leonMSFT left a comment

Choose a reason for hiding this comment

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

As far as I can see this looks pretty good, but I'd like to get other eyes on it too bc there's a lot here 😄

src/cascadia/TerminalApp/TerminalSettings.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/TerminalSettings.cpp Outdated Show resolved Hide resolved
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.

This looks like mainly mechanical moves to me. I'm fine with this. But I'd like @DHowett to also sign as he's been closer to this shuffling than me.

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.

I love love love this. Just some fit and finish stuff.

src/cascadia/TerminalApp/ColorScheme.h Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/KeyMapping.idl Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/Profile.idl Outdated Show resolved Hide resolved
@@ -1030,8 +1030,7 @@ namespace winrt::TerminalApp::implementation
const auto& profileGuid = focusedTab->GetFocusedProfile();
if (profileGuid.has_value())
{
const auto settingsImpl{ winrt::get_self<implementation::CascadiaSettings>(_settings) };
const auto settings = settingsImpl->BuildSettings(profileGuid.value());
const auto settings{ winrt::make<TerminalSettings>(_settings, profileGuid.value(), *_bindings) };
Copy link
Member

Choose a reason for hiding this comment

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

how is this different from BuildSettings?

Copy link
Member Author

Choose a reason for hiding this comment

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

Function Params
Constructor CascadiaSettings, guid, IKeyBindings
BuildSettings CascadiaSettings, NewTerminalArgs, IKeyBindings

Before, they were both BuildSettings. But the second BuildSettings needs to return a tuple so we can't just make that another constructor :(

src/cascadia/TerminalApp/TerminalPage.h Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/TerminalSettings.cpp Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Sep 11, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Sep 14, 2020
@carlos-zamora carlos-zamora assigned DHowett and unassigned leonMSFT Sep 14, 2020
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Sep 14, 2020
@ghost
Copy link

ghost commented Sep 14, 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 abf8805 into master Sep 14, 2020
@ghost ghost deleted the dev/cazamor/set/key-mapping branch September 14, 2020 20:39
@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:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants