Vinzent03 / tab-switcher

Tab Switcher - Obsidian Plugin
GNU General Public License v3.0
123 stars 6 forks source link

Wraparound Issue with Notes in Sidebar #7

Closed phibr0 closed 3 years ago

phibr0 commented 3 years ago

However, in my case, that's probably due to an Obsidian issue that prevents making a sidebar document active. (Obsidian allows dragging a document into a sidebar pane, but it doesn't allow making it "active", even though you can click into it and edit it.) Sidebar documents are included in iterateLeaves() and getLeavesOfType("markdown"), so this plugin attempts to cycle through them. But since they cannot be made active, the previously-active leaf remains active, so the cycling stops.

One way to fix that would be for this plugin to skip such leaves when moving forward or backward. A simple way to do this is to check that the workspace.activeLeaf has actually changed after calling setActiveLeaf(). If it hasn't, then the leaf wasn't suitable, and needs to be skipped in the rotation. This approach should be forward compatible in case Obsidian ever actually allows sidebar leaves to become active.

~ @pjeby

pjeby commented 3 years ago

Thanks! This works correctly with the current Obsidian.