Hi,
I found a way to reproduce a bug found in āset_viewport_positionā
1 - With default sublime installation and no plugins. Even with all the default py files uninstalled (this makes no difference).
2 - Save this script as file set_viewport_position_bug.py
import sublime, sublime_plugin
class setviewport_bug(sublime_plugin.EventListener):
def on_load(self, view):
view.set_viewport_position((0, 500), False)
print view.viewport_position()
This will set the vertical position to 500 on every file you open.
3 - Now open a big file via āmain menu barā -> āfileā -> āopen fileā
I selected for convenience the file āPackages/Color Scheme - Default/Monokai.tmThemeā (please select the same file.)
You will see that the view port is scrolled correctly to 500.
You can check this from the console with :
>>> sublime.active_window().active_view().viewport_position()
(0.0, 500.0)
4 - Now, here is the bug.
Open the same file via the sidebar. And you will notice that the view is not scrolled.
>>> sublime.active_window().active_view().viewport_position()
(0.0, 20.0)
It stay on (0.0, 20.0). Iām not sure the reason on this, but it seems that there is something in the sidebar that is setting this value to 20.
This same thing happens when using āCTRL+Pā, so I guess this has somthing to do with the code of the āpreviewā
Can you please do a quick check if there is something there overwriting this value. Because most of the time is unusable and this api is very handy.
I would recommend to use the file āPackages/Color Scheme - Default/Monokai.tmThemeā because the problem is reproducible 100%
Thanks.