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

8247: Custom key bindings are broken for tab navigation #8250

Merged
1 commit merged into from
Nov 13, 2020

Conversation

Don-Vito
Copy link
Contributor

@Don-Vito Don-Vito commented Nov 12, 2020

There are two code paths for Ctrl+Tab and for everything else:

Ctrl + Tab is working perfectly

  • On the first tab navigation TerminalPage::_SelectNextTab resets the
    tab commands, and since palette is not visible selects the relevant
    tab index
  • On the second navigation Ctrl+Tab is intercepted by
    CommandPalette::_previewKeyDownHandler and everything works fine

But with custom binding things are screwed:

  • On the first tab navigation TerminalPage::_SelectNextTab resets the
    tab commands, and since palette is not visible selects the relevant
    tab index
  • On the second navigation keys are not intercepted and thus
    TerminalPage::_SelectNextTab is called again. It resets the commands,
    but now since the palette is visible we simply invoke
    CommandPalette::SelectNextItem. Which in turn misbehaves because no
    item is selected.

The approach for the solution is not to reset anything if the command
palette is already open.

Validation Steps Performed

  • Manual testing of both custom and non-custom bindings with different
    amount of tabs.

Closes #8247

@Don-Vito
Copy link
Contributor Author

@zadjii-msft - please review.

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.

Wow, I shipped a lot of bad code this release :(

@Don-Vito
Copy link
Contributor Author

Wow, I shipped a lot of bad code this release

@zadjii-msft - This one is tough to notice while coding, unless everything is covered with UTs or there are manual testers. You cannot expect to find such a thing in dogfooding (I never even considered of binding tabs).

BTW, I am not coding too much these days, but when I do, I always ship a lot of bad code ☺️

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.

ARGH, thank you. Great catch!

@DHowett
Copy link
Member

DHowett commented Nov 13, 2020

@msftbot merge this in 1 minute

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Nov 13, 2020
@ghost
Copy link

ghost commented Nov 13, 2020

Hello @DHowett!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Fri, 13 Nov 2020 01:33:12 GMT, which is in 1 minute

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@ghost ghost merged commit 0437fe9 into microsoft:main Nov 13, 2020
DHowett pushed a commit that referenced this pull request Nov 20, 2020
There are two code paths for Ctrl+Tab and for everything else:

Ctrl + Tab is working perfectly
* On the first tab navigation TerminalPage::_SelectNextTab resets the
  tab commands, and since palette is not visible selects the relevant
  tab index
* On the second navigation Ctrl+Tab is intercepted by
  CommandPalette::_previewKeyDownHandler and everything works fine

But with custom binding things are screwed:
* On the first tab navigation TerminalPage::_SelectNextTab resets the
  tab commands, and since palette is not visible selects the relevant
  tab index
* On the second navigation keys are not intercepted and thus
  TerminalPage::_SelectNextTab is called again. It resets the commands,
  but now since the palette is visible we simply invoke
  CommandPalette::SelectNextItem. Which in turn misbehaves because no
  item is selected.

The approach for the solution is not to reset anything if the command
palette is already open.

## Validation Steps Performed
* Manual testing of both custom and non-custom bindings with different
  amount of tabs.

Closes #8247

(cherry picked from commit 0437fe9)
DHowett pushed a commit that referenced this pull request Nov 20, 2020
There are two code paths for Ctrl+Tab and for everything else:

Ctrl + Tab is working perfectly
* On the first tab navigation TerminalPage::_SelectNextTab resets the
  tab commands, and since palette is not visible selects the relevant
  tab index
* On the second navigation Ctrl+Tab is intercepted by
  CommandPalette::_previewKeyDownHandler and everything works fine

But with custom binding things are screwed:
* On the first tab navigation TerminalPage::_SelectNextTab resets the
  tab commands, and since palette is not visible selects the relevant
  tab index
* On the second navigation keys are not intercepted and thus
  TerminalPage::_SelectNextTab is called again. It resets the commands,
  but now since the palette is visible we simply invoke
  CommandPalette::SelectNextItem. Which in turn misbehaves because no
  item is selected.

The approach for the solution is not to reset anything if the command
palette is already open.

* Manual testing of both custom and non-custom bindings with different
  amount of tabs.

Closes #8247

(cherry picked from commit 0437fe9)
@ghost
Copy link

ghost commented Nov 20, 2020

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

Handy links:

@ghost
Copy link

ghost commented Nov 20, 2020

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

Handy links:

@Don-Vito Don-Vito deleted the 8247-fix-no-tab-selected branch December 3, 2020 17:02
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
3 participants