12
獲取所有文字我試圖創建一個崇高的文本3
插件現在我只得到可以選擇在一個窗口中的所有文本,並將其複製在另一個窗口。
代碼:崇高的文本3 API:從文件
import sublime, sublime_plugin
class PrintCodeCommand(sublime_plugin.WindowCommand):
def run(self):
# for each caracter, add it to a string with the substr method
s = ""
for x in range(0,self.window.active_view().size()):
s += self.window.active_view().substr(x)
newFile = self.window.new_file()
newFile.run_command("test",{"textBuffer": s})
class Test(sublime_plugin.TextCommand):
def run(self, edit, textBuffer):
self.view.insert(edit, 0, textBuffer)
你知道一個更好/更簡單的方法來做到這一點?
謝謝!