[PR #3658] Encapsulate dispatching ShortcutActions in it's own class #25467

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

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

State: closed
Merged: Yes


Summary of the Pull Request

Moves all the code responsible for dispatching an ActionAndArgs to it's own class, ShortcutActionDispatch. Now, the AppKeyBindings just uses the single instance of a ShortcutActionDispatch that the TerminalPage owns to dispatch events, without the need to re-attach the event handlers every time we reload the settings.

References

This is something I originally did as a part of #2046.

I need this now for #607.

It's also a part of work for #3475

PR Checklist

  • This is a bullet point within #3475
  • I work here
  • Tests added/passed
  • [n/a] Requires documentation to be updated

Detailed Description of the Pull Request / Additional comments

With this change, we'll be able to have other things dispatch ShortcutActions easily, by constructing an ActionAndArgs and just passing it straight to the ShortcutActionDispatch.

Validation Steps Performed

Ran the Terminal, tried out some keybindings, namely Ctrl+c for copy when there is a selection, or send ^C when there isn't. That still works.

Reloading settings also still works.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/3658 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Moves all the code responsible for dispatching an `ActionAndArgs` to it's own class, `ShortcutActionDispatch`. Now, the `AppKeyBindings` just uses the single instance of a `ShortcutActionDispatch` that the `TerminalPage` owns to dispatch events, without the need to re-attach the event handlers every time we reload the settings. ## References This is something I originally did as a part of #2046. I need this now for #607. It's also a part of work for #3475 ## PR Checklist * [x] This is a bullet point within #3475 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments With this change, we'll be able to have other things dispatch `ShortcutAction`s easily, by constructing an `ActionAndArgs` and just passing it straight to the `ShortcutActionDispatch`. ## Validation Steps Performed Ran the Terminal, tried out some keybindings, namely <kbd>Ctrl+c</kbd> for copy when there is a selection, or send `^C` when there isn't. That still works. Reloading settings also still works.
claunia added the pull-request label 2026-01-31 09:09:42 +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#25467