【发布时间】:2013-11-11 22:02:03
【问题描述】:
如何获取整行的文本,我在其上找到了光标。我想我必须为此对region1 做点什么:
import sublime, sublime_plugin
class line_text_plugin__Command(sublime_plugin.WindowCommand):
def run(self):
print('line_text_plugin__ called')
view = self.window.active_view()
region1 = view.sel()[0]
# lineText = how to get whole line text, on which I got cursor
...但我不知道如何将region1 转换为行文本。
region1 在我的代码中是首选区域。
这个插件应该如下工作:
例如,如果我将光标放在第 6 行...
...它必须返回字符串view = self.window.active_view()
【问题讨论】:
-
我不认为当前光标位置与当前选择相同——sublime 允许同时使用多个。
标签: python plugins sublimetext2 sublimetext sublimetext3