-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixing tabmove not working properly when there's a split in pane #3371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not looked at code related with tabs much before so I tried looking at other files but I think the fix is correct.
internal/action/command.go
Outdated
@@ -198,7 +198,10 @@ func (h *BufPane) TabMoveCmd(args []string) { | |||
idxTo = util.Clamp(idxTo, 0, len(Tabs.List)-1) | |||
|
|||
activeTab := Tabs.List[idxFrom] | |||
Tabs.RemoveTab(activeTab.ID()) | |||
if len(activeTab.Panes) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove this check. If there is a tab without panes, it is a bug, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I can remove it.
I saw this check in RemoveTab()
so I thought it was needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In RemoveTab()
it is probably not needed either... Also RemoveTab()
looks quite weird overall: it checks specifically p.Panes[0]
, not any other pane of the tab (not to mention that it is inconsistent with its documentation, which says that it checks the id of the tab itself).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was a bit confused as well but decided not to change it given that other places are using the pane id seems like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "Removing redundant check on pane ID" in the commit message is gonna be confusing to the readers.
853de02
to
02c934d
Compare
02c934d
to
a16e33c
Compare
Fixing tabmove not working properly when there's a split in pane (zyedidia#3371)
This fixes #3072 . Please see the issue for the problem.
It now uses the first pane ID inside the tab instead of the tab ID itself.
To test this,
tabmove -1
ortabmove 1
when you are at the middle tab.