Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

titoBouzout opened this Issue Apr 24, 2013 · 3 comments


2 participants

titoBouzout commented Apr 24, 2013

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 "bug.py" 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.


titoBouzout commented Feb 6, 2014

Looks fixed? :D


titoBouzout commented Feb 6, 2014

No.. it does not work!

@keith-hall keith-hall added S: minor and removed S: major labels Apr 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment