I am trying to create separate up/down commands to select things inside the autocomplete box, to disambiguate from the ordinary up/down inside the editor—specifically, I would like the latter to act as if the autocomplete box had never popped up at all.
In so doing, I need a command that executes, e.g., “close autocomplete and go up one line”. I’m having problems with the “go up” part, after the autocomplete window is closed.
Here’s my code:
def move_up(view):
view.run_command("move", {"by": "lines", "forward": False})
def hide_auto_complete(view):
view.run_command("hide_auto_complete")
class CloseAutoCompleteAndGoUpCommand(sublime_plugin.TextCommand):
def run(self, edit):
hide_auto_complete(self.view)
move_up(self.view)
This only works as expected when the selected line in the autocomplete window is the first line of the window. Symmetrically, the inverted command…
def move_down(view):
view.run_command("move", {"by": "lines", "forward": True})
class CloseAutoCompleteAndGoDownCommand(sublime_plugin.TextCommand):
def run(self, edit):
hide_auto_complete(self.view)
move_down(self.view)
…only works as expected when the selected line in the autocomplete window is the last line of the window.
Does someone have a clue what’s going on?