Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent arrow keys from dismissing tab renamer #9633

Merged
2 commits merged into from
Mar 29, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/cascadia/TerminalApp/TabHeaderControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
DHowett marked this conversation as resolved.
Show resolved Hide resolved
_receivedKeyDown = true;

// GH#9632 - mark navigation buttons as handled.
// This should prevent the tab view to use this key for navigation between tabs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this break ctrl-left (move back word), shift-left (select leftward), etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this will not break it. The internal behavior remains unchanged (actually, since this even is bubbling up, it cannot physically affect the internal behavior). It just suggests the parent not to handle this event.

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
Expand Down