SublimeText/WordHighlight — pull request #7 by titoBouzout (2011-10-29 01:24:29+00:00)
Title: Use time instead of thread.

Now, this one tries a different approach, using time instead of threading. ( works much better on windows, needs some basic feedback about how it works in different systems )

Previous version, was queuing in a different thread all hits to on_selection_modified.

Timer.cancel was cancelling the last hit and appending a new one. That way we avoided many calls to "highlight word". Implementation required jumps on threads, queue and cancelling a lot of tasks. This added an almost invisible delay on drawing the "highlight".

Now, instead of listening every hit to on_selection_modified, we maintain a timer there, and skip all request with lower time than 0.05 sec ( for example selecting a lot of text ). That way we consume less processor ( by skipping hits without queue and cancelling ), and we also don't need to jump from threads, drawing the highlight at the same time than sublime.

Is very unlikely a user will double click in less than 0.05 sec :P

OK, Regards !