Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evandrocoan/c1aa0cd4547e11f96a8dd428de3d3235 to your computer and use it in GitHub Desktop.
Save evandrocoan/c1aa0cd4547e11f96a8dd428de3d3235 to your computer and use it in GitHub Desktop.
import sublime
import sublime_plugin

class MaxPaneEvents(sublime_plugin.EventListener):

    def on_selection_modified(self, view):
        print( 'I am on_selection_modified...', view.id() )


class TestCommand(sublime_plugin.TextCommand):

    def run(self, edit, index):
        view = self.view
        print( 'I am on_selection_modified...', view.id() )
        
        point = index * 3
        view.sel().add(sublime.Region(point, point))


def delayed_restore(index):
    index -= 1
    print('index', index)

    active_view = sublime.active_window().active_view()
    active_view.run_command("test", {"index": index})

    if index > 30:
        sublime.set_timeout(lambda: delayed_restore(index), 1000)

# sublime.set_timeout(lambda: delayed_restore(40), 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment