Sublime Forum

EventListener returning command doesn't seem to work?

#1

According to the docs, on_text_command should allow you to alter or run a different command, but if I return anything, the command just gets eaten. I think this should scroll if it hit 'ctrl+UP`. It prints out “scroll” but does not scroll the window. Why doesn’t this work?

class EventTrap(sublime_plugin.EventListener):
	def on_text_command(self, view, command, args):
		if command == 'scroll_lines':
			print("scroll")
			return (command, args)
0 Likes

#2

on_text_command is also run for commands overridden by on_text_command. As such the code you’ve provided leads to an infinite loop. In order to not lock up the whole application this is detected and the command is ignored.

0 Likes

#3

That makes sense.

It would be nice to log a msg, rather than silently eating the event.

0 Likes