Skip to content


Subversion checkout URL

You can clone with
Download ZIP


set_viewport_position does not work for some XML/HTML files #4

titoBouzout opened this Issue · 3 comments

1 participant


It looks like sometimes a call to "set_viewport_position" does not work, or is overwritten by the editor for some very specific file types.

The following code is supposed to scroll vertically any view to position "500" when the file loads. And it prints the new position to the console.

import sublime, sublime_plugin
class setviewport_bug(sublime_plugin.EventListener):
    def on_load(self, view):
         view.set_viewport_position((0, 5000), False)
         print (view.viewport_position())

Steps to reproduce the bug:

Save this code as file "" o the "Packages/User" folder

  • Open a big file of the type XML or HTML, with more than 30 lines
  • The first time you open a file it stay at line 1, when it should scroll to something bigger.
  • The next time you open this file will scroll correctly.

It looks like sublime text, overwrites the scroll the first time the a file is opened, but not, the next time you open the same file [from sidebar]
The problem is always reproducible when you open a file from -> File -> Open Recent -> Pick the file.


Looks fixed? :D


No.. it does not work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.