111b88c8a3
## 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. ----------------------------------------------- * Move action handling to it's own class separate from AKB. This is the first checkbox in #3475 (cherry picked from commit 696726b571d3d1fdf1d59844c76e182fc72cb2ea) * clean up doc comments
21 lines
758 B
Plaintext
21 lines
758 B
Plaintext
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
import "../ActionArgs.idl";
|
|
import "../ShortcutActionDispatch.idl";
|
|
|
|
namespace TerminalApp
|
|
{
|
|
[default_interface] runtimeclass AppKeyBindings : Microsoft.Terminal.Settings.IKeyBindings
|
|
{
|
|
AppKeyBindings();
|
|
|
|
void SetKeyBinding(ActionAndArgs actionAndArgs, Microsoft.Terminal.Settings.KeyChord chord);
|
|
void ClearKeyBinding(Microsoft.Terminal.Settings.KeyChord chord);
|
|
|
|
Microsoft.Terminal.Settings.KeyChord GetKeyBindingForAction(ShortcutAction action);
|
|
Microsoft.Terminal.Settings.KeyChord GetKeyBindingForActionWithArgs(ActionAndArgs actionAndArgs);
|
|
|
|
void SetDispatch(ShortcutActionDispatch dispatch);
|
|
}
|
|
}
|