From 704836e45d91acfc4a9f883fd15c3aea6f46a3db Mon Sep 17 00:00:00 2001 From: Don-Vito Date: Mon, 29 Mar 2021 20:23:09 +0300 Subject: [PATCH] Prevent arrow keys from dismissing tab renamer (#9633) ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/issues/9632 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [ ] I've discussed this with core contributors already. --- src/cascadia/TerminalApp/TabHeaderControl.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/TabHeaderControl.cpp b/src/cascadia/TerminalApp/TabHeaderControl.cpp index 37045dcb0dc..47cb16ba298 100644 --- a/src/cascadia/TerminalApp/TabHeaderControl.cpp +++ b/src/cascadia/TerminalApp/TabHeaderControl.cpp @@ -18,8 +18,18 @@ namespace winrt::TerminalApp::implementation // We'll only process the KeyUp event if we received an initial KeyDown event first. // Avoids issue immediately closing the tab rename when we see the enter KeyUp event that was // sent to the command palette to trigger the openTabRenamer action in the first place. - HeaderRenamerTextBox().KeyDown([&](auto&&, auto&&) { + HeaderRenamerTextBox().KeyDown([&](auto&&, auto&& e) { _receivedKeyDown = true; + + // GH#9632 - mark navigation buttons as handled. + // This should prevent the tab view to use this key for navigation between tabs + if (e.OriginalKey() == Windows::System::VirtualKey::Down || + e.OriginalKey() == Windows::System::VirtualKey::Up || + e.OriginalKey() == Windows::System::VirtualKey::Left || + e.OriginalKey() == Windows::System::VirtualKey::Right) + { + e.Handled(true); + } }); // NOTE: (Preview)KeyDown does not work here. If you use that, we'll