Permalink
Browse files

doesn't shift the view when opening new files

Sublime Text seems to call on_selection_modified before the contents of the
view have fully loaded. A simple solution is to call the plugin again once
the on_activated call comes, which is after a view's first
on_selection_modified.
  • Loading branch information...
1 parent c675384 commit 08cc9e2e963a43e7b8a2554dedef7bd3a54ad2e8 @adzenith adzenith committed with Nikolaus Wittenstein Mar 9, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 scroll_offset.py
View
@@ -43,6 +43,9 @@ def find_selection_limits(view):
return first_caret_row, last_caret_row, leftmost_caret_rowcol, rightmost_caret_rowcol
class ScrollOffset(sublime_plugin.EventListener):
+ def on_activated(self,view):
+ self.on_selection_modified(view)
+
def on_selection_modified(self, view):
settings = view.settings()
vertical_offset = abs(int(settings.get("scroll_offset_vertical") or 0))

0 comments on commit 08cc9e2

Please sign in to comment.