Skip to content

Commit

Permalink
Fix an infinite loop when pressing alt (#15253)
Browse files Browse the repository at this point in the history
As discussed in
#14051 (comment)

regressed in #15189
  • Loading branch information
zadjii-msft authored May 11, 2023
1 parent 48eee4d commit 0553f3e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/cascadia/TerminalApp/TerminalWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,19 @@ namespace winrt::TerminalApp::implementation
{
focusedObject = winrt::Windows::UI::Xaml::Media::VisualTreeHelper::GetParent(focusedElement);

// We were unable to find a focused object. Default to the xaml root so that the alt+space menu still works.
// We were unable to find a focused object. Give the
// TerminalPage one last chance to let the alt+space
// menu still work.
//
// We return always, because the TerminalPage handler
// will return false for just a bare `alt` press, and
// don't want to go around the loop again.
if (!focusedObject)
{
focusedObject = _root.try_as<IInspectable>();
if (auto keyListener{ _root.try_as<IDirectKeyListener>() })
{
return keyListener.OnDirectKeyEvent(vkey, scanCode, down);
}
}
}
}
Expand Down

0 comments on commit 0553f3e

Please sign in to comment.