deathau / sliding-panes-obsidian

Andy Matuschak Mode as a plugin
747 stars 29 forks source link

Sliding Pane Won't Close #109

Open gwillcox-r7 opened 2 years ago

gwillcox-r7 commented 2 years ago

When opening certain panes a new blank pane will open. If I try to close that pane, now it will continuously open that pane again....and again....and again. Its now impossible to close that second pane down so I'm left with a screen that constantly looks like this:

image

This seems to have only occurred after I updated to the latest plugin version aka 3.3.0 about 2-3 days ago.

gwillcox-r7 commented 2 years ago

Hmm so seem to have narrowed this down a bit. This seems to only occur when one of the items is a pinned item in Obsidian. If you unpin the item to the left, then things work fine and the panel to the right will close. Repinning does not trigger the malignant behavior thankfully.

mrkuramoto commented 2 years ago

Hi Grant (gwillcox-r7), I'm facing exactly what you described. Is this a bug or expected behavior of the plugin? I reported "the problem" but haven't received any comment (https://github.com/deathau/sliding-panes-obsidian/issues/106).

Thank you

visaeryon commented 2 years ago

i am too facing this bug when i updated this plugin today, i reverted back to the release 3.2.3 manually to get rid of this bug.

transmitthis commented 2 years ago

Same bug here also same details as gwillcox-r above

gwillcox-r7 commented 2 years ago

Hi Grant (gwillcox-r7), I'm facing exactly what you described. Is this a bug or expected behavior of the plugin? I reported "the problem" but haven't received any comment (#106).

Thank you

I believe this is new, it didn't act like this before from what I can tell and @Vichu-dev's comment suggests this is a regression.

MILKMILKKING commented 2 years ago

我今天更新这个插件时也面临这个错误,我手动恢复到版本 3.2.3 以摆脱这个错误。

Can you please tell me if you can get back to normal after reverting to version 3.2.3? I still have the problem of not being able to close the page after reverting to version 3.2.3.

antomonte commented 2 years ago

Yes, I'm facing the same issue. At the very moment that the plugin is enabled, it creates an empty pane which is impossible to get closed.

https://user-images.githubusercontent.com/5910/181754677-08ff3535-cccd-4dfa-9928-6f842c5fc050.mp4

This happens if all the open panes were pinned. If any open tab gets unpinned, then makes it possible to close such an empty pane. For doing this video testing, ALL other plugins were turned OFF, and Obsidian was also restarted.

I'm using the latest versions, that is: Obsidian: v0.15.9 Sliding Panes plugin: 3.3.0

This behaviour makes it pretty uncomfortable to deal with the panes. Please correct it if possible.

Thanks!

torves commented 2 years ago

I've come here after experiencing the same issue myself. I've dug into the Sliding Panes source a bit and found the cause of the issue.

This is caused by calling Workspace.getLeaf in the Obsidian API. Internally it will call getUnpinnedLeaf which returns the default start screen if there are no unpinned leaves. https://github.com/deathau/sliding-panes-obsidian/blob/8e91d95d7bc91d167b9d1bfa5c07ac2bc3d34acd/src/main.ts#L262

The active leaf is used when deciding if it should be focused when it is currently in the active container. https://github.com/deathau/sliding-panes-obsidian/blob/8e91d95d7bc91d167b9d1bfa5c07ac2bc3d34acd/src/main.ts#L324-L325

I'm not sure why this is done, seems to be related to Obsidian popout windows. I've been using a modified version of the Sliding Panes plugin with those bits of code removed without noticing any issues.

MILKMILKKING commented 2 years ago

@torves I don't know anything about code at all, can you please teach me how to delete these codes?

visaeryon commented 2 years ago

@torves I don't know anything about code at all, can you please teach me how to delete these codes?

I would suggest reverting back to 3.2.3 release manually and see if the bug is fixed, before trying the code deletion method.

mrkuramoto commented 2 years ago

Hello torves,

Thank you very much for your tip, it worked smoothly. I edit the file "main.js" in sliding-panes-obsidian directory and added "//" in front of "workspace.getleaf"... the code line in my file was not exactly the same as your code but searching by "workspace.getLeaf" was enough to find and neutralize the codes

mrkuramoto commented 2 years ago

I would like to share what I did to fix the problem based on the @torves' comments (thank you very much)

I was suspicious of the possibility to lose the content of the "today's daily notes"... now I'm sure that it doesn't happen.

01 - go to the Obsidian plugin folder 02 - find the plugin called "sliding-panes-obsidian" (it is a folder) 03 - inside the folder, find a file called "main.js" 04 - right click and choose "open with" 05 - it is possible to choose "notepad" -> I'm using "Atom" which is free and offer a very nice interface 06 - find this line "if (activeLeaf.getContainer() === rootSplit && widthChange)" 07 - neutralize it adding "//" in front of the line 08 - find this line "_this.focusLeaf(activeLeaf, !_this.settings.leafAutoWidth);" 09 - neutralize it adding "//" in front of the line 10 - DO NOT TOUCH THIS LINE "var rootSplit = activeLeaf.getContainer();" 11 - find this line " // var activeLeaf = _this.app.workspace.getLeaf();" 12 - neutralize it adding "//" in front of the line 13 - that's all, save the file and restart Obsidian

I hope those steps could help someone

MILKMILKKING commented 2 years ago

I would like to share what I did to fix the problem based on the @torves' comments (thank you very much)

Important - always backup your data! I don't know the reason but I lost the content of my Daily Note when I was doing the steps described below. Nothing to do, but I lost.

01 - go to the Obsidian plugin folder 02 - find the plugin called "sliding-panes-obsidian" (it is a folder) 03 - inside the folder, find a file called "main.js" 04 - right click and choose "open with" 05 - it is possible to choose "notepad" -> I'm using "Atom" which is free and offer a very nice interface 06 - find this line "if (activeLeaf.getContainer() === rootSplit && widthChange)" 07 - neutralize it adding "//" in front of the line 08 - find this line "_this.focusLeaf(activeLeaf, !_this.settings.leafAutoWidth);" 09 - neutralize it adding "//" in front of the line 10 - DO NOT TOUCH THIS LINE "var rootSplit = activeLeaf.getContainer();" 11 - find this line " // var activeLeaf = _this.app.workspace.getLeaf();" 12 - neutralize it adding "//" in front of the line 13 - that's all, save the file and restart Obsidian

I hope those steps could help someone

I tried your method with Notepad and it solved the problem of not being able to close blank windows perfectly and without any file loss! Thank you very much for your help!

mrkuramoto commented 2 years ago

Hello @MILKMILKKING, I'm glad to hear that!! 😀😀😀

mrkuramoto commented 2 years ago

hahaha, Obsidian v0.16.0 has just been released and changed everything. Obsidian 0.16 introduces a new default theme, a new theme versioning system, and several important new features. We expect that most themes and plugins will need some tweaks.

gwillcox-r7 commented 2 years ago

Well Obisidian 0.16.2 just introduced tab stacks which should essentially offer most of the same functionality as this plugin. I'll leave this issue open but if anyone is looking for an intermediate solution in the meantime this may be something to look into.