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

keyboard shortcut for tab switching #1677

Merged
merged 3 commits into from
Apr 22, 2024
Merged

keyboard shortcut for tab switching #1677

merged 3 commits into from
Apr 22, 2024

Conversation

knotbin
Copy link
Contributor

@knotbin knotbin commented Apr 21, 2024

Description

The following keyboard shortcuts are now implemented:
CMD + SHIFT + ] to go to the next tab or, if the user is on the last tab, wrap around to the first tab
CMD + SHIFT + [ to go to the previous tab or, if the user is on the first tab, wrap around to the last tab

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

@austincondiff austincondiff self-requested a review April 22, 2024 13:37
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

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

Thanks for the fantastic work! There are a few small adjustments we need to make in order to merge this.

These keyboard shortcuts should probably be associated with menu items instead of empty buttons...

  • Navigate > Show Previous Tab
  • Navigate > Show Next Tab

These currently exist but are disabled so all you should need to do is hook them up to the functions you wrote.

We also need to make sure that this is only applied to the focused editor and not applied to all open editors if the user has a split editor layout.

@knotbin
Copy link
Contributor Author

knotbin commented Apr 22, 2024

Thanks so much for all the feedback and sorry for the incredibly janky initial workaround. I just fixed the menu bar implementation by adding an extension to the editor with the functions I made and using those in the NavigateCommands. Because NavigateCommands uses @FocusedObject, it only tabs the focused split now. Tell me if you want anything else changed or fixed and thanks again for the feedback.

austincondiff
austincondiff previously approved these changes Apr 22, 2024
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

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

Looks good to me! ✅

Edit: Please fix the SwiftLint errors.

@knotbin
Copy link
Contributor Author

knotbin commented Apr 22, 2024

SwiftLint errors all fixed 👍

@austincondiff austincondiff merged commit 1694b8c into CodeEditApp:main Apr 22, 2024
2 checks passed
@austincondiff
Copy link
Collaborator

@allcontributors add @knotbin for code

Copy link
Contributor

@austincondiff

I've put up a pull request to add @knotbin! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ ⇧⌘[ and ⇧⌘] keyboard shortcuts to cycle between editor tabs in the active editor
3 participants