I noticed this problem and was curious as to why it happens:
#sublime_plugin.TextCommand
def run(self, edit):
for region in self.view.sel():
self.view.run_command('insert_snippet', {'contents': str(region.b)})
if I run this command on multiple cursors via a keybinding Sublime inserts something like:
5813
5813
5813
instead of what self.view.insert(edit, region.b, str(region.b)) would for example:
5
8
13
Does anyone know if this limitation of run_command is intended or could it be considered a bug?
If this is because the code runs asynchronously and run_command executes only after the loop shouldn’t this output just the last ‘region.b’ in this case ‘13’.
This isn’t a blocking problem for me I’m just curious to know how this code is running.
Edit: Thanks.