[PR #15773] Raise ShortcutActions with the sender (tab, control) context #30732

Open
opened 2026-01-31 09:42:38 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/15773

State: closed
Merged: Yes


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 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.

  • TerminalPage::_HandleTogglePaneZoom
  • TerminalPage::_HandleFocusPane
  • TerminalPage::_MoveTab

Closes #15734

**Original Pull Request:** https://github.com/microsoft/terminal/pull/15773 **State:** closed **Merged:** Yes --- 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
claunia added the pull-request label 2026-01-31 09:42:38 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30732