[PR #8882] Hook up the keybindings to the SUI #27319

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

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

State: closed
Merged: No


Summary of the Pull Request

This is really similar to what we're doing with the CommandPalette. We're adding a PreviewKeyDown handler to the SUI MainPage, that connects to TerminalPage::_HandleKey. That allows the SUI a chance to search the keymap to dispatch actions for keybindings, similar to how the command palette does it.

This also means it's now possible for the SUI to invoke all the actions available to the Terminal. This includes the ones like IncreaseFontSize, which require a Terminal to actually do something. So we have to make sure all the calls to _GetActiveControl actually check that the result is non-null before using it.

A bunch of the actions do nothing now from a SUI tab, others behave weird. Like "Rename tab" / "Open Tab Renamer" do nothing. "Duplicate Tab" again does nothing - we try making a new settings tab, which just focuses the settings tab again. "Copy text" definitely does nothing, same with paste.

PR Checklist

Validation Steps Performed

I performed all the actions that I changed. I did not test all actions exhaustively, because I felt that searching for callers of GetActiveTerminalControl() was exhaustive enough.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/8882 **State:** closed **Merged:** No --- ## Summary of the Pull Request This is really similar to what we're doing with the CommandPalette. We're adding a `PreviewKeyDown` handler to the SUI `MainPage`, that connects to `TerminalPage::_HandleKey`. That allows the SUI a chance to search the keymap to dispatch actions for keybindings, similar to how the command palette does it. This also means it's now possible for the SUI to invoke _all_ the actions available to the Terminal. This includes the ones like `IncreaseFontSize`, which require a _Terminal_ to actually do something. So we have to make sure all the calls to `_GetActiveControl` actually check that the result is non-null before using it. A bunch of the actions do nothing now from a SUI tab, others behave _weird_. Like "Rename tab" / "Open Tab Renamer" do nothing. "Duplicate Tab" again does nothing - we try making a new settings tab, which just focuses the settings tab again. "Copy text" definitely does nothing, same with paste. ## PR Checklist * [x] Closes #8767 * [x] I work here * [ ] Tests not added * [n/a] Requires documentation to be updated ## Validation Steps Performed I performed all the actions that I changed. I did not test all actions exhaustively, because I felt that searching for callers of `GetActiveTerminalControl()` was exhaustive enough.
claunia added the pull-request label 2026-01-31 09:21:18 +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#27319