Sublime Forum

No redraw when using set_timeout?

#1

[code]import sublime, sublime_plugin

class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):

self.start = 0
self.end = 500

# this works
# self.set_region()

sublime.set_timeout(lambda: self.set_region(), 1)

def set_region(self):
self.view.sel().clear()
self.view.sel().add(sublime.Region(self.start, self.end))[/code]
When running this command you notice that the region is not correctly drawn to the current view. Any idea?

0 Likes