Sublime Forum

On_text_command hook not run for commands executed using view.run_command


I have an event listener with an on_text_command function that modifies some commands under certain circumstances.

I also have a command that takes a command name + args as input, mucks around with my active views a bit, and then calls view.run_command(command_name, args) on my active view after I’m done mucking around with them.

I noticed that the on_text_command hook never gets run for commands that I issue in such a manner (i.e., using view.run_command). My current workaround is to manually call the hook function myself before calling view.run_command and then pass the modified values to view.run_command, but I don’t think this should be necessary?

(NOTE: I’ve tried using the new chain for this – I forget exactly why, but I couldn’t get it working with chain either. I think chain might not have ran the hook either?)


1 Like