Nice catch.
The plug-in saves the “state” when the tab is closed, an optimal and non obstructive way.
As I’m seeing… unfortunately sublime is not sending “on_close” event when switching projects. In a similar way sublime is not sending “on_close” when the application is closed…
Then, the plug-in miss the data because is not informed.
A workaround is to save the data when the tab lose focus(on_deactivated). But that means 1 write every time you switch a tab or the tab lose focus, unnecessary, dirty and not optimal.
Also, another problem is that folded regions can be obtained by unfolding the actual folds, this means every time you switch a tab or the tab lose focus the buffer need to be unfolded and refolded…
I’ve added the workaround to the plug-in… update and please be informed I’m not happy and complete dislike this solution.
[edit] - Another problem is that the application by default tries to do its own restoration but this is not working properly for most of the files. then I need to put a time-out to not get my restoration overwrited, which is something I dislike too.