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

Switching Tabs if there's no pane in the direction #471

Merged
merged 2 commits into from
May 10, 2021

Conversation

dantepippi
Copy link
Contributor

New behavior for Alt + 'h' and Alt + 'l': will switch tabs if there are no available panes in the direction.
Closes #464

Copy link
Member

@kunalmohan kunalmohan left a comment

Choose a reason for hiding this comment

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

Hey! Thanks for the PR. This looks good! I haven't tested it yet though; a couple of small changes before I do that.

You'll have to create a new match arm with the new Action variant in

match action {

And check for the direction. Since we might be switching tabs if the direction is left or right, we'll have to block the input thread in those cases (using the two command_is_executing methods) to ensure atomicity for those actions. Once these are completed, we unblock the input thread by sending the UnblockInputThread message.

We should also have tests for these changes :)

src/server/mod.rs Outdated Show resolved Hide resolved
src/server/mod.rs Outdated Show resolved Hide resolved
New behavior for h and l, will change tabs if there are no available
panes in the direction.

cargo clippy

Ensuring atomicity for the MoveFocusOrTab

- Blocking the input thread for the action MoveFocusOrTab
- Using "unreachable" macro in match arm to make it clear that the
directions Up and Down should not be used with the action MoveFocusOrTab

Adding tests
Copy link
Member

@kunalmohan kunalmohan left a comment

Choose a reason for hiding this comment

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

LGTM! @dantepippi this is a great feature with a neat implementation! Thank you for your patience!

@kunalmohan kunalmohan merged commit 74526a9 into zellij-org:main May 10, 2021
@dantepippi dantepippi deleted the switch-tabs-464 branch May 10, 2021 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: navigating left/right should switch tabs if there's no pane
2 participants