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

Provide global setting to use ATS for nextTab and prevTab #7321

Merged
22 commits merged into from
Aug 21, 2020

Conversation

leonMSFT
Copy link
Contributor

@leonMSFT leonMSFT commented Aug 17, 2020

Summary of the Pull Request

This PR splits the anchored and unanchored tab switcher into two. The anchored tab switcher is now baked into nextTab/prevTab, and the unanchored tab switcher command is just named tabSearch. tabSearch takes no arguments. To reflect this distinction, CommandPalette.cpp now refers to one as TabSwitchMode and the other as TabSearchMode.

I've added a global setting named useTabSwitcher (name up for debate) that makes the Terminal use the anchored tab switcher experience for nextTab and prevTab.

I've also given the control the ability to detect Alt KeyUp events and to dispatch keybinding events. By listening for keybindings, the ATS can react to nextTab/prevTab invocations for navigation in addition to listening for tab and the arrow keys.

Closes #7178

PR Checklist

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Aug 17, 2020
@leonMSFT leonMSFT changed the title Provide global setting to use ATS for nextTab/prevTab Provide global setting to use ATS for nextTab and prevTab Aug 17, 2020
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Could you update the PR description with more details? All this stuff with "tabSearch" was throwing me off.

src/cascadia/TerminalApp/defaults.json Outdated Show resolved Hide resolved
src/cascadia/TerminalControl/IControlSettings.idl Outdated Show resolved Hide resolved
@@ -119,6 +119,7 @@ namespace winrt::TerminalApp::implementation
if (auto page{ weakThis.get() })
{
_UpdateCommandsForPalette();
CommandPalette().SetKeyBindings(_settings->GetKeybindings());
Copy link
Member

Choose a reason for hiding this comment

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

(curious) why?

Copy link
Member

Choose a reason for hiding this comment

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

This isn't actually "set the bindings on the command palette", this is "attach the combined [key binding list and key binding key-receiver action dispatcher] to the palette" which is absolutely required for the palette to dispatch key binding events.

Copy link
Member

Choose a reason for hiding this comment

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

if we had a better separation of responsibilities here, we would be able to give command palette a key binding handler whose only bound actions were next/prev tab

Copy link
Member

Choose a reason for hiding this comment

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

(and then it could handle them itself). but right now our key binding command dispatch interface is an interface containing 100 functions it would need to implement and it is tied up with the actual deserializer code. heck.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Carlos, looks like you've made a couple comments below about the same keybindings topic so I'll move all the discussion here:

Yeah I honestly didn't know how to trim down the given bindings to just nextTab and prevTab 😢
I'm mostly hoping that because the control needs to be kept open with a modifier key, and there's no search bar and the only interactable interface is a list view, the range of actions a user would want to do is limited.

Like, if you've hit ctrl+tab to open the tab switcher, and for some odd reason you shift your fingers to invoke find which could be something like ctrl+shift+f, it'll show the find dialog and leave the tab switcher open. But IMO that's pretty inconvenient considering the whole time you'd have to hold down ctrl and shift your hand/fingers. Also, If you're holding down ctrl, you're saying you want the tab switcher to stay open while opening the find dialog?

But, I guess, then again, the whole "bad faith actor" is a valid reason to rip this out and just not allow users to use their nT/pT keybinding to navigate.

Copy link
Member

Choose a reason for hiding this comment

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

Downloaded the branch and tested it. Yeah, this works fine. And scenarios like "opening the search box while the tab switcher is open" would probably fall under the "play stupid games" category. Fixing this is probably more effort than it's worth right now, so good enough for me!

Copy link
Member

Choose a reason for hiding this comment

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

Also, I want this for "dispatch a keybinding while the palette is open". Like, if the user opens the palette, sees the keybinding for "new tab" is ctrl+shift+t, they should be able to just press that and have it do the right thing, you know?

src/cascadia/TerminalApp/ActionAndArgs.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/AppActionHandlers.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.idl Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.cpp Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 18, 2020
@carlos-zamora carlos-zamora removed their assignment Aug 18, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 18, 2020
@leonMSFT
Copy link
Contributor Author

My bad 😅 the PR description was looking very bare.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

this seems way cleaner (even though it added more direct manipulation from the page to the switcher control). interested to see how @zadjii-msft feels about it

src/cascadia/TerminalApp/AppActionHandlers.cpp Outdated Show resolved Hide resolved
// Use the VisualTreeHelper's GetParent as a fallback.
if (!focusedObject)
{
focusedObject = winrt::Windows::UI::Xaml::Media::VisualTreeHelper::GetParent(focusedElement);
Copy link
Member

Choose a reason for hiding this comment

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

clever!

Copy link
Member

Choose a reason for hiding this comment

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

i'm surprised this mostly just worked -- binding the direct handler, that is :)

Co-authored-by: Dustin L. Howett <[email protected]>
@DHowett
Copy link
Member

DHowett commented Aug 20, 2020

i'm blocking on @zadjii-msft having a closer look, but I am not horribly worried about anything in here

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

At first from reading the description, I thought I'd hate this. But after playing with it, I really liked how it felt, and I especially love how much simpler a lot of the code is. I'm not blocking this because overall I think this is good. I just have like the tiniest nits, but you need to fix the merge conflicts anyways 😄

@@ -68,7 +68,7 @@
"wt",
"closeOtherTabs",
"closeTabsAfter",
"tabSwitcher",
Copy link
Member

Choose a reason for hiding this comment

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

useTabSwitcher probably needs to get added to this file too

@@ -7,6 +7,7 @@
#include "ActionArgs.h"
#include "Command.h"

#include <WinUser.h>
Copy link
Member

Choose a reason for hiding this comment

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

Did we need this just for VK_MENU? IMO we might as well include it in the pch, since I doubt this is the last time we'll need it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah just for VK_MENU, I'll throw it in pch

@@ -576,6 +576,9 @@
<data name="SetColorSchemeParentCommandName" xml:space="preserve">
<value>Select color scheme...</value>
</data>
<data name="TabSearchCommandKey" xml:space="preserve">
<value>Tab Search</value>
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to make this a tad bit more... interactive? Perhaps something like "Search for tab..." (kinda like "Set the tab color..." - it's not technically a nested command, but it is a sequence of actions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yeah "Search for tab..." looks pretty decent 👍

@@ -119,6 +119,7 @@ namespace winrt::TerminalApp::implementation
if (auto page{ weakThis.get() })
{
_UpdateCommandsForPalette();
CommandPalette().SetKeyBindings(_settings->GetKeybindings());
Copy link
Member

Choose a reason for hiding this comment

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

Also, I want this for "dispatch a keybinding while the palette is open". Like, if the user opens the palette, sees the keybinding for "new tab" is ctrl+shift+t, they should be able to just press that and have it do the right thing, you know?

@carlos-zamora carlos-zamora removed their assignment Aug 20, 2020
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

:shipit:

@zadjii-msft zadjii-msft removed their assignment Aug 21, 2020
…aptain-now

# Conflicts:
#	src/cascadia/TerminalApp/Resources/en-US/Resources.resw
@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 21, 2020
@ghost
Copy link

ghost commented Aug 21, 2020

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 3d370dc into master Aug 21, 2020
@ghost ghost deleted the dev/lelian/im-the-captain-now branch August 21, 2020 15:39
@ghost
Copy link

ghost commented Aug 26, 2020

🎉Windows Terminal Preview v1.3.2382.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the Tab Switcher to initialize going backwards
4 participants