Sublime Forum

Restoring scroll-position after document manipulation

#1

I have a plugin that makes changes to certain documents via a regexp before they are saved.

It works, but after every save the scroll-position jumps to where ever the plugin made its last change, which isn’t necessarily the line I’m looking at.

Is there a way to “lock” the scroll-position while changes are being made, or at least restore the original?

Thanks in advance!

0 Likes

#2

Assuming you’re using view.replace() to make the change, this will be causing the issue. From the next build, view.replace() will be fixed to no longer scroll the view.

0 Likes

#3

Yes, I’m using view.replace(). Thanks for the quick response!

0 Likes