Skip to content

Instantly share code, notes, and snippets.

@abolibibelot
Last active December 21, 2015 20:09
Show Gist options
  • Save abolibibelot/6359206 to your computer and use it in GitHub Desktop.
Save abolibibelot/6359206 to your computer and use it in GitHub Desktop.
This snippet traps double clicks in a Sublime Text plugin. I kid you not.
trapping_views = {VIEW_BREAKPOINT: dbg.callbacks.on_breakpoints_dblclick,VIEW_STACK: dbg.callbacks.on_stack_dblclick}
class UnityTrapDoubleclickCommand(TextCommand):
def run_(self, args):
print 'on dbl click'
special_handler = trapping_views.get(self.view.name(),None)
print args
if not special_handler is None:
line = self.view.line(self.view.sel()[0])
special_handler(line)
else: # default handling by Sublime Text
system_command = args["command"] if "command" in args else None
if system_command is None: return
system_args = dict({"event": args["event"]}.items() + args["args"].items())
self.view.run_command(system_command, system_args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment