-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Raise ShortcutActions with the sender (tab, control) context #15773
Conversation
…d the event, as a parameter to ShortcutActionDispatch::DoAction
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Third thought about using actions: actually, I like it even more than I expected. It removes the handlers dance from Page.
winrt::Microsoft::Terminal::Control::TermControl _senderOrActiveControl(const winrt::Windows::Foundation::IInspectable& sender); | ||
winrt::com_ptr<TerminalTab> _senderOrFocusedTab(const IInspectable& sender); |
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.
For the future: technically, we might want the concept of a "stack" of senders. A message coming from a control has an associated pane and tab and eventually, window. Those things might matter to different recipients, or different action types.
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.
Exactly what Dustin said. LGTM though.
…ispatch-with-sender
This PR's goal is to allow something like a `Tab` to raise a ShortcutAction, by saying "this action should be performed on ME". We've had a whole category of these issues in the past: * #15734 * #15760 * #13579 * #13942 * #13942 * Heck even dating back to #10832 So, this tries to remove a bit of that footgun. This probably isn't the _final_ form of what this refactor might look like, but the code is certainly better than before. Basically, there's a few bits: * `ShortcutActionDispatch.DoAction` now takes a `sender`, which can be _anything_. * Most actions that use a "Get the focused _thing_ then do something to it" are changed to "If there was a sender, let's use that - otherwise, we'll use the focused _thing_". * TerminalTab was largely refactored to use this, instead of making requests to the `TerminalPage` to just do a thing to it. I've got a few TODO!s left, but wanted to get initial feedback. * [x] `TerminalPage::_HandleTogglePaneZoom` * [x] `TerminalPage::_HandleFocusPane` * [x] `TerminalPage::_MoveTab` Closes #15734 (cherry picked from commit 30eb9ee) Service-Card-Id: 90438493 Service-Version: 1.18
This PR's goal is to allow something like a
Tab
to raise a ShortcutAction, by saying "this action should be performed on ME". We've had a whole category of these issues in the past:So, this tries to remove a bit of that footgun. This probably isn't the final form of what this refactor might look like, but the code is certainly better than before.
Basically, there's a few bits:
ShortcutActionDispatch.DoAction
now takes asender
, which can be anything.TerminalPage
to just do a thing to it.I've got a few TODO!s left, but wanted to get initial feedback.
TerminalPage::_HandleTogglePaneZoom
TerminalPage::_HandleFocusPane
TerminalPage::_MoveTab
Closes #15734