diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index e36fadd6a..3e3d7414e 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -900,6 +900,24 @@ namespace winrt::Microsoft::Terminal::Control::implementation return; } + if (vkey == VK_SPACE && modifiers.IsAltPressed()) + { + if (const auto bindings = _settings.KeyBindings()) + { + if (!bindings.IsKeyChordExplicitlyUnbound({ modifiers.IsCtrlPressed(), modifiers.IsAltPressed(), modifiers.IsShiftPressed(), modifiers.IsWinPressed(), vkey, scanCode })) + { + // If we get here, it means that + // 1. we do not have a command bound to alt+space + // 2. alt+space was not explicitly unbound + // That means that XAML handled the alt+space to open up the context menu, and + // so we don't want to send anything to the terminal + // TODO GH#11018: Add a new "openSystemMenu" keybinding + e.Handled(true); + return; + } + } + } + if (_TrySendKeyEvent(vkey, scanCode, modifiers, keyDown)) { e.Handled(true);