- Code: Select all
def run(self, edit):
view = self.view.window().open_file(os.path.join(os.path.cwd(), "test.txt"))
The file opens correctly, however view.size() returns 0 for this returned view object, as does sublime.active_window().active_view().size(). Any idea what could be going wrong?
*Edit* - If the file is already open, then it works as expected. So it looks like size() is zero because the view object is still being initialize (or something like that). Could someone please point me towards how I could add a callback or listener that would be triggered once the view has fully loaded? I don't think I can use on_load as-is, because I need to jump to a particular line after loading the file, and that would have to be passed as an argument to the callback.
*Edit 2* - view.is_loading()