Hello,
I’m writing plugin which must insert some text in active editor. So far I have this:
#!/usr/bin/env python3
from urllib.request import urlopen
import sublime_plugin
class GetFile(sublime_plugin.WindowCommand):
def run(self):
self.window.show_input_panel(
'URL pliku do pobrania:',
'Podaj URL pliku do pobrania',
self.__on_done,
self.__on_change,
self.__on_cancel
)
def __on_done(self, url):
response = urlopen(url)
text_data = response.read().decode('utf-8')
active_editor = self.window.active_view()
if active_editor:
active_editor.run_command('insertCharacters', {'characters': text_data})
def __on_change(self, text):
pass
def __on_cancel(self):
pass
Why command “insertCharacters” does not work?
I’m sure that problem is in line “active_editor.run_command(‘insertCharacters’, {‘characters’: text_data})” it simply being executed and nothing happens
thx