Sublime Forum

Expand to end of current line after typing something in input_panel not working

#1

I am testing out following:

import sublime, sublime_plugin

class ExampleCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		w = self.view.window()
		w.show_input_panel("Select to line number:", "", self.on_done, None, None)

	def on_done(self, input):
		caretPos = self.view.sel()[0].begin()
		self.view.sel().add(sublime.Region(caretPos, self.view.line(caretPos).end()))

In console, I run view.run_command('example').

After typing something in the input panel and press enter there should be an expand selection to the end of the line. But nothing happens. Only if I do soft_undo and then soft_redo it will expand.

How can this be solved?

0 Likes