I’d like the ‘Find’ panel to launch with a clean slate every time I launch it. I’ve been trying to write a TextCommand for this but have been failing. Here’s what I have so far:
class LaunchEmptyFindPanelCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().run_command("show_panel", {"panel": "find"})
panel_view = self.view.find_output_panel("find")
panel_view.run_command("delete_word", {"forward": False, "sub_words": False})
I think the problem is with the line
panel_view = self.view.find_output_panel("find")
that is not retrieving the view
object of the find panel. (How do I check/debug this by the way? I haven’t found a way to write to the console.) So I think my question is really: how do I get my hands on the panel’s view
object?
Also, the delete_word
command is just a hack that will only work when the previous search involved only one word. I would be happy to know the correct way of wiping the contents of the Find panel.