I’m writing a plugin that keeps markdown tables aligned while you type. The listener is:
class AlignMarkdownTableListener(sublime_plugin.ViewEventListener):
@classmethod
def is_applicable(self, settings):
return settings.get('syntax').endswith('gfm.sublime-syntax')
def on_modified(self):
self.view.run_command('align_markdown_table')
The command align_markdown_table
will check whether the table is correctly aligned and call view.erase
or view.insert
zero or more times. I’m getting a RuntimeError: maximum recursion depth exceeded
. Presumably, the command is triggering the listener.
Is there a reasonable way to keep this from happening?