Home Download Buy Blog Forum Support

Run command "drag_select" from a Text/WindowCommand?

Run command "drag_select" from a Text/WindowCommand?

Postby oliverseal on Wed Sep 07, 2011 2:14 pm

Anyone know the context of the "drag_select" command run in the mousemap files?
I'm working on a click-drag plugin, and the first thing I need to be able to do is allow for a normal click event to happen if there's no selection. I can't fire the 'drag_select' command, though.
Tried the following:
Code: Select all
import sublime, sublime_plugin
class DragSelectionCommand(sublime_plugin.TextCommand):
    def run(self, edit):

Not working and console has no output. Anyone else with experience? Perhaps the great jps or sublimator?
Posts: 4
Joined: Fri Jun 24, 2011 7:47 pm

Re: Run command "drag_select" from a Text/WindowCommand?

Postby jps on Thu Sep 08, 2011 3:41 am

drag_select is a view command, and requires an event argument to be passed, containing the cursor position and the pressed mouse button. If you implement run_ rather than run you will get access to the event (take a look through sublime_plugin.py in the same directory as the executable to see an example).

It's also worth turning on command logging (via sublime.log_commands(True) ) to see the commands that normally get run.

That being said, I don't think you'll have much luck getting text dragging working via a plugin.
Site Admin
Posts: 3217
Joined: Wed Mar 19, 2008 12:33 pm

Return to Plugin Development

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests