ericcornelissen/pinned-tabs-for-atom

Wrong tabs pinned on reopening Atom if "Project Find Results" tab was pinned

Closed this issue ยท 5 comments

I noticed that when I start Atom I always had a tab I hadn't pinned among the pinned ones. I found out that this is caused by Project Find Results tab, which I usually keep pinned, not existing when I launch start. It seems the package tries to keep the same amount of tabs pinned as I had before quitting, but now one of them doesn't exist and it assumes the leftmost non-pinned tab it's the one that was.

To reproduce the issue:

  • Have at least one buffer tab open.
  • Do a "Find in Project".
  • Pin "Project Find Results" tab.
  • Restart Atom

Thx for reporting this. I was aware this could happen, but never encountered a situation where it would, which is why I sticked with this approach...

But now that you found a way to break my approach I had to change how the package works (something I should've done earlier probably, considering I was aware of the risks ๐Ÿ˜…) I found another way to remember what tabs where pinned the last time the editor was open, but I'm not 100% sure it will always work... So I pushed the branch with that solution to Github and will be testing it thoroughly in the next few days. You can help me testing by cloning the repo into ..\.atom\packages\ and checking out on branch issue-21 ๐Ÿ˜„

I can't seem to find any problems with the new approach so I'm just going to close this issue. The fix will be included in the next update (which I will get out asap) ๐Ÿ˜„

Thanks, that was fast! ๐ŸŽ

I found a new problem was introduced, though (sorry about that). Pinned tabs containing PDFs don't come back as pinned on restart. It seems to do with https://github.com/izuzak/atom-pdf-view, the package I'm using to render PDFs, since disabling it solves the problem.

From what I can see in d6d81dd, I can imagine where the problem may come from. My wild guess:

  • pdf-view changes the ID of the tab at runtime.
  • pinned-tabs stores the already changed ID.
  • On start pinned-tabs tries to pin the tab but the ID hasn't been changed yet by pdf-view.

No problem, thanks for letting me know so quickly ๐Ÿ˜„ I'll look into this asap!

You where almost right. pdf-view doesn't change the ID, it actually doesn't have an ID (as it is a jQuery object for some reason ๐Ÿ˜“). A similar problem most likely occurs with some other package out there. Besides that the image viewer build into Atom also doesn't give an ID.

So, I came up with a different solution ๐Ÿ˜„ the package will now use an items URI if it cannot find an ID (using the URI can lead to different problems, because it is just a string of the file path... But its the best I could come up with))