Home Download Buy Blog Forum Support

Restoring scroll-position after document manipulation

Restoring scroll-position after document manipulation

Postby shuckster on Fri Jun 17, 2011 12:44 pm

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!
shuckster
 
Posts: 2
Joined: Fri Jun 17, 2011 12:33 pm

Re: Restoring scroll-position after document manipulation

Postby jps on Fri Jun 17, 2011 1:25 pm

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.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Restoring scroll-position after document manipulation

Postby shuckster on Fri Jun 17, 2011 3:06 pm

Yes, I'm using view.replace(). Thanks for the quick response!
shuckster
 
Posts: 2
Joined: Fri Jun 17, 2011 12:33 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests