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

Implemented new actions FirstTab, LastTab, FirstSplit and LastSplit #3403

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

masmu
Copy link
Contributor

@masmu masmu commented Jul 28, 2024

This PR changes the default behavior of NextTab, PreviousTab, NextSplit, PreviousSplit to not walk in circles anymore but instead splits those actions up into more atomic actions.

So e.g. NextTab just selects the next tab but doesn't switch to the first tab in case you run the action on the last tab. A new action FirstTab has been added and can be chained to restore the original behavior.

"PreviousTab"     ->       "PreviousTab|LastTab",
"NextTab"         ->       "NextTab|FirstTab",
"PreviousSplit"   ->       "PreviousSplit|LastSplit",
"NextSplit"       ->       "NextSplit|FirstSplit",

This adds a lot of flexibility to the user to create more sophisticated keybindings.

The following keybinding allows a combination of split and tab switching:

"Alt-,": "PreviousSplit|PreviousTab|LastTab",
"Alt-.": "NextSplit|NextTab|FirstTab",

@masmu
Copy link
Contributor Author

masmu commented Aug 17, 2024

I have just found another bug concerning the order of the split selection.

When adding a new BufPane it is always being inserted last into MainTab().Panes.
This leads to a confusion when using the actions PreviousSplit, NextSplit as the next/previous split may not be the expected one.

How to reproduce:

  • Launch micro and insert char "1"
  • Open a new vsplit via the command vsplit and insert "2"
  • Switch back to the left split (1) by using PreviousSplit
  • Again open a new vsplit via command: vsplit and type char "3"
  • Now switch between the 3 splits using PreviousSplit, NextSplit

Switching from most left split to the most right, the expected order would be 1, 3, 2 but actually is 1, 2, 3.

internal/action/actions.go Outdated Show resolved Hide resolved
internal/action/actions.go Outdated Show resolved Hide resolved
internal/action/actions.go Outdated Show resolved Hide resolved
internal/action/actions.go Outdated Show resolved Hide resolved
…Split` and changed the default behavior of `NextTab`, `PreviousTab`, `NextSplit`, `PreviousSplit` to not walk in circles anymore
…t array index.

When adding a new `BufPane` it is always being inserted last into `MainTab().Panes`.
This leads to a confusion when using the actions `PreviousSplit`, `NextSplit` as the previous/next split may not be the expected one.

How to reproduce:
- Launch micro and insert char "1"
- Open a new vsplit via the command `vsplit` and insert "2"
- Switch back to the left split (1) by using `PreviousSplit`
- Again open a new vsplit via command: `vsplit` and type char "3"
- Now switch between the 3 splits using `PreviousSplit`, `NextSplit`

Switching from most left split to the most right, the expected order would be 1, 3, 2 but actually is 1, 2, 3.
@dmaluka dmaluka requested a review from JoeKar September 15, 2024 14:46
Copy link
Collaborator

@JoeKar JoeKar left a comment

Choose a reason for hiding this comment

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

Looks OK to me too 👍, but I have to be honest that I didn't test it so far.

@dmaluka
Copy link
Collaborator

dmaluka commented Sep 16, 2024

I did. :)

@dmaluka dmaluka merged commit 9eaeb19 into zyedidia:master Sep 16, 2024
3 checks passed
@masmu
Copy link
Contributor Author

masmu commented Sep 17, 2024

Thanks for your time and the reviews guys. 👍

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.

3 participants