ericcornelissen / pinned-tabs-for-atom

A package for the Atom text editor that allows you to pin tabs
https://atom.io/packages/pinned-tabs
MIT License
18 stars 3 forks source link

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

Closed OmeGak closed 8 years ago

OmeGak commented 8 years ago

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:

ericcornelissen commented 8 years ago

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 :sweat_smile:) 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 :smile:

ericcornelissen commented 8 years ago

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) :smile:

OmeGak commented 8 years ago

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 d6d81ddc910eda95191c258960662dd1cee067b2, I can imagine where the problem may come from. My wild guess:

ericcornelissen commented 8 years ago

No problem, thanks for letting me know so quickly :smile: I'll look into this asap!

ericcornelissen commented 8 years ago

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 :sweat:). 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 :smile: 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))