Sublime Forum

Restore session, does not set the last scroll position after a project change, or sublime restart

#1

Restore session, does not set the last scroll position after a project change, or sublime restart

Does anyone else experimenting/bothering within this issue?
https://github.com/SublimeTextIssues/Core/issues/1379

Expected behavior

Is expected to all opened file view to be restored to the exacly position they were, after a project change, or program restart.

Actual behavior

After the project is changed or the program is restarted, all files

except the current opened are restored within the wrong scroll position.

Steps to reproduce

  1. Install sublime text
  2. Create one project file, add some folders, open some files, set them all to the same view (current caret line and scrolling), switch the project or restart sublime text.
  3. After open sublime text, go to check the other tabs/opened files, all files except the current opened will be at a different position.
  4. This is a full video demonstrating it: Project_wrong_view_scrool_restare.zip, https://vid.me/2Lj0
  5. This is the project used on the video: https://github.com/evandrocoan/Galileo
    (after open the project, open the same files as opened on the video)

complete_ultra_clean_install_demonstration video

https://vid.me/ijjZ

See? some times, within small files, works ok.
But other times within big files, it is a mess. The current file always go ok, other other, not ok. And as you may see, it is the default install, within a fresh start/clean new projects and work spaces. All the projects used are open source, and you may download the exacly same files within:


github.com/evandrocoan/2016-2_OperatingSystems (this last will rename to something like, but will remaing a link by github)

Using the setting:

		"scroll_past_end": false,

Completely aggravate the problem. Now it completely scrool to the first line on all views, except the current one, when switching projects or restarting sublime text.

Environment

  • Operating system and version:
    • [x] Windows 10…
    • [ ] Mac OS …
    • [ ] Linux …
  • Sublime Text:
    • Build 3114
1 Like

#2

I’m noticing this too. Currently working on some lambda functions (AWS), and switching between projects constantly. Expecting to be able to be at the same point in ALL open files, and it’s only the current file which remembers the scroll location.

Basically, I can confirm everything here. Would love to see a fix for this.

Sublime build 3216
Mac OS 10.12.5

0 Likes

#3

seems to work okay for me - have you created (saved) a .sublime_workspace file for your project? it is there that the translation.y is stored against the sheets, so that when you re-open the project, it will remember your scroll position etc.

0 Likes

#4

I created a package to fix the issue:

  1. https://github.com/evandrocoan/SublimeTextStudio/blob/develop/Fix%20Project%20Switch-Restart%20Bug/fix_project_switch_restart_bug.py

After loading the project, it goes to each view and set the scroll to the cursor/caret position.
Which is much better than always messed up.

Is valid to note that, it only happens for big files as 500 lines about 90% of the time. But yes, we have
the .sublime-workspace created. Sublime creates always.

0 Likes

#5

there’s also https://github.com/titoBouzout/BufferScroll

0 Likes

#6

@kingkeith Yep, I’ve tried deleting and recreating the .sublime_workspace file a few times to no avail. Just to be clear, after switching back to a project, the current active file remembers the scroll position just fine, but when switching to another file, Sublime forgets.

@addons_zz Thanks so much! However, unfortunately I’m having trouble getting this to work smoothly. When switching back to a project, your package is definitely doing something as it seems to do a bunch of flashing and scrolling to various locations, but then when I switch to the file I was hoping it would remember the scroll position, it’s still not correct. It’s different than it would be without the package, but not exactly where I left it.

0 Likes

#7

Thanks @domie, I seem to be having some luck with this!

0 Likes

#8

You need to wait all the view to be selected, then more 2 or 3 seconds after the scrolling to be able to switch correctly. I recorded a animation using my fix:

I also use the buffer scroll with some changes than the original.
I did it because I had some trouble using it then I fixed what was wrong for me.

  1. https://github.com/evandrocoan/BufferScroll

You can see what I changed on:

  1. https://github.com/evandrocoan/BufferScroll/commits/master
0 Likes

#9

It’s so unfortunate that we still don’t have scroll/line position persistence as a native feature of the IDE :frowning:

I edit HTML a lot, the BufferScroll’s ST3-originating shortcoming of not remembering the HTML position is annoying

Also it does fail pretty regularly, but it’s still better than nothing

1 Like