Sublime text plugin: Scrolling selected region to top of window

218 views Asked by At

Here's what I have working so far, which finds a region starting with /* Output: to the end of the file, then displays that region in the window.

import sublime, sublime_plugin

class ShowJavaExampleOutput(sublime_plugin.EventListener):
    def on_load(self, view):
        if view.file_name().endswith(".java"):
            output_region = view.find(r"/\* Output:.*", 0)
            if output_region:
                view.show(output_region)

This works, but I'd like the line containing /* Output: to always appear at the top of the window. Is there a way to do that?

0

There are 0 answers