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

Close tab and go to adjacent tab: causes focus to be on right tab group #64

Open
IanCKW opened this issue Feb 19, 2025 · 7 comments
Open

Comments

@IanCKW
Copy link

IanCKW commented Feb 19, 2025

Steps to produce

  1. Two tab groups with multiple tabs within each group.
    left L be the left tab group, and R be the right tab group

  2. Focus on the rightmost tab in L

  3. hit hotkey for Pane Relief: Close tab and go to adjacent tab

  4. tab closed

Expected result

  1. Obsidian focuses on the next rightmost tab in L

Actual Result

  1. Obsidian focuses on the leftmost tab in R

Elaboration

This is unlike the standard close tab behaviour in Obsidian, which does not change focus to another tab group unless all the tabs in the current group have been closed

@pjeby
Copy link
Owner

pjeby commented Feb 19, 2025

Hm. Maybe I should just remove this command? It was added at a time when Obsidian's default close behavior was to switch to the most-recently used pane -- and in fact Obsidian did not have tab groups or tabs at all, only panes. I'm not using it myself and I'm not sure what it should be used for exactly, given the existence now of tabs and tab groups.

@IanCKW
Copy link
Author

IanCKW commented Feb 20, 2025

I personally enjoy this command since it allows me to close tab and focus on the right tab. Standard close current tab closes the tab then focuses on the left tab.

By setting your hotkey Pane Relief: Close tab and go to adjacent tab to ctrl w and then setting the standard close current tab to ctrl shift w I can parallel how I navigate to the right with ctrl tab and navigate to the left tab with ctrl shift tab.

i.e. by moving my left index finger from w to tab (while holding down ctrl and shift) , I can go from closing to navigating and vice versa

@pjeby
Copy link
Owner

pjeby commented Feb 20, 2025

So why not just use ctrl-shift-w when closing the last tab in a group, if that does what you want? Wouldn't that make more sense if what you want is to close to the left in that case?

@IanCKW
Copy link
Author

IanCKW commented Feb 20, 2025

|--------tab-group-1------|------tab-group-2--------|
|-tab1.a-|-tab1.b-|-tab1.c-|-tab2.a-|-tab2.b-|-tab2.c-|

Yes your solution is a workaround that currently works. But it's a hassle to have to remember to do that when trying to close the last tab in the tab group. And if one doesn't remember that, when I am trying to close multiple notes in a tab group, I end up closing tabs that I didn't intend on closing in the adjacent tab group.

In the base Obsidian close tab functionality, if I am in the leftmost tab of a tab group (e.g. tab2.a), and I close tab2.a, I am "protected" from focusing on tab1.b (and the focus is on tab2.b now). This "protection" is especially useful for when intending on closing multiple tabs in a tab group. i.e. base close current tab only applies to the tab group being focussed on. pane-relief: close tab and go to adjacent tab applies across tab groups feels like unintentional functionality

@pjeby
Copy link
Owner

pjeby commented Feb 20, 2025

Sure -- but if I change it, then somebody else is likely to complain that it's unintentional to go the other way, because they're used to the way it is. Arguably, the way it is is actually correct, in the sense that before tabs existed, this always went to the next note in the workspace, regardless of pane (tab group). The only thing that's been changed since the feature was added was what text shows in the command name. (And note that the text promises only adjacency, not which direction!)

I will consider adding a new command, or perhaps changing the behavior. But I want to give it some thought first because at this point I would actually prefer to just get rid of the command entirely: it was always a workaround for some ancient Obsidian behavior that went away years ago, and I forgot it even existed until you mentioned it. 😁 (OTOH, that is maybe a good indication it won't shoot someone else in the foot if it's changed... but that's why I need to think about it.)

@IanCKW
Copy link
Author

IanCKW commented Feb 20, 2025

Ah would be a shame to lose it. Welp, thanks for explaining to me why it is the way it is. I appreciate the plugin!

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

No branches or pull requests

3 participants
@pjeby @IanCKW and others