I’d like to implement my own version of the builtin split_into_lines command, so far I’ve got this:
class MySplitIntoLinesCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
lst = []
for s in view.sel():
for i,l in enumerate(view.lines(s)):
if i==0:
lst.append(Region(s.begin(),l.end()))
else:
lst.append(l)
view.sel().clear()
view.sel().add_all(lst)
but it doesn’t work as the original one… guess using view.lines isn’t the way to go here.
I’ve found on the internet a vscode extension that looks like this, pretty interesting that lineAt
method…
Can you think of a simple way to implement this one? I can think of few but I’d like a simple one that uses the Sublime API