Home Download Buy Blog Forum Support

clearing sublime.set_timeout

clearing sublime.set_timeout

Postby DSHugo on Sun Oct 16, 2011 8:39 pm

Hello,

Is there, by chance, a counterpart of sublime.set_timeout(), which would allow canceling the timeout?
The thing I'm trying to do is to call a method on on_selection_modified, but prevent it from executing the portion of code when the user is in process of dragging the mouse (and execute the aforementioned code only once, when selection hasn't changed in e.g. 0.05 sec). I have it already done with python Timer object, but using ST api would be more efficient, I think.
DSHugo
 
Posts: 42
Joined: Tue Sep 20, 2011 11:05 am

Re: clearing sublime.set_timeout

Postby adzenith on Sun Oct 16, 2011 9:33 pm

What method are you using to detect when the user is dragging the mouse? I am very interested!
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: clearing sublime.set_timeout

Postby DSHugo on Sun Oct 16, 2011 9:44 pm

@adzenith:
Heh heh, I'm speaking about WordHighlight plugin you are working on from time to time :D — so, it should be pretty much nothing new for you (at least concerning the on_selection_modified). As for the rest, you should see a fork on github, but the changes aren't complete yet — I have them tested under Linux, and will be testing on Windows tomorrow.
Last edited by DSHugo on Sun Oct 16, 2011 9:49 pm, edited 1 time in total.
DSHugo
 
Posts: 42
Joined: Tue Sep 20, 2011 11:05 am

Re: clearing sublime.set_timeout

Postby adzenith on Sun Oct 16, 2011 9:47 pm

Excellent! I look forward to it. :)
I'm trying to mouse-detect for my scroll-offset plugin, actually—right now selecting with the mouse near the edge of the buffer scrolls the view, which is undesirable to say the least.
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 9 guests