Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. ```python
  2. import sublime
  3. import sublime_plugin
  4.  
  5. class MaxPaneEvents(sublime_plugin.EventListener):
  6.  
  7. def on_selection_modified(self, view):
  8. print( 'I am on_selection_modified...', view.id() )
  9.  
  10.  
  11. class TestCommand(sublime_plugin.TextCommand):
  12.  
  13. def run(self, edit, index):
  14. view = self.view
  15. print( 'I am on_selection_modified...', view.id() )
  16.  
  17. point = index * 3
  18. view.sel().add(sublime.Region(point, point))
  19.  
  20.  
  21. def delayed_restore(index):
  22. index -= 1
  23. print('index', index)
  24.  
  25. active_view = sublime.active_window().active_view()
  26. active_view.run_command("test", {"index": index})
  27.  
  28. if index > 30:
  29. sublime.set_timeout(lambda: delayed_restore(index), 1000)
  30.  
  31. # sublime.set_timeout(lambda: delayed_restore(40), 1000)
  32. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement